[ 4 posts ]

Marc

YUI Contributor

  • Offline
  • Profile
Tags:

Custom Comboloader and css image assets

Post Posted: Mon Feb 06, 2012 7:12 am
+0-
Hi,

I use a custom comboloader that basically stitches together scripts and gives that back.

http://www.mydomain.com/yui/?dir/comp.js&/dir2/comp2.js

When certain modules use their own css files, these are loaded also by the comboloader. But when these module css files contain image references, things go wrong because they are interpreted by the browser
as

http://www.mydomain.com/yui/component_image.png

because they are referenced in the css file simply as

background:url(component_image.gif)

I'm just wondering how to deal with this?

Kind regards,

Marc

Ryan Grove

YUI Developer

  • Username: rgrove
  • Joined: Tue Dec 09, 2008 9:55 pm
  • Posts: 275
  • Location: Portland, OR
  • Twitter: yaypie
  • GitHub: rgrove
  • Gists: rgrove
  • IRC: rgrove
  • YUI Developer
  • Offline
  • Profile
Tags:

Re: Custom Comboloader and css image assets

Post Posted: Mon Feb 06, 2012 9:44 am
+0-
The paths in the CSS files will need to be rewritten, either as absolute URLs or as paths relative to the combo root. For YUI, we do this at build time when our CDN resources are generated.

Daniel Stockman sent a pull request for my Node.js combohandler that can rewrite paths in CSS files on demand, but I haven't integrated it yet because I need to do some architecture work first. It might give you some ideas, though: https://github.com/rgrove/combohandler/pull/3

Marc

YUI Contributor

  • Offline
  • Profile

Re: Custom Comboloader and css image assets

Post Posted: Mon Feb 06, 2012 11:37 am
+0-
Am I correct in assuming this will not work with non "sam" based assets?

Marc

YUI Contributor

  • Offline
  • Profile
Tags:

Re: Custom Comboloader and css image assets

Post Posted: Mon Feb 06, 2012 12:16 pm
+0-
No, actually, not a problem if you use the combo css url as a basis for inserting your image urls.
  [ 4 posts ]
Display posts from previous:  Sort by  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum