sbecker / asset_packager

JavaScript and CSS Asset Compression for Production Rails Apps
http://synthesis.sbecker.net/pages/asset_packager
516 stars 102 forks source link

How to package stylesheets with local images? #7

Open tschofen opened 14 years ago

tschofen commented 14 years ago

I'm using jquery plugins. Each is a separate folder in my javascript directory. These folders contain css files and images that are referred to from the css files. When asset_packager combined these files the path to the images is not adapted to find the images in their original folder. An example: Part of my .yml file:

Given the following files javascript/tools/styles.css => in this file a reference to url(tooltip.png) refers to the following file: javascript/tools/tooltip.png

After packaging the image reference hasn't changed and the image can't be found.

Can this be accomplished?

Thanks

wkrsz commented 13 years ago

asset_packager would have to scan for relative patchs and replace them with absolute ones. Can be implemented, but definitely not trivial. And I suspect the solution would be error-prone.

PhilT commented 13 years ago

The Jammit packager can do this although it uses the YUI compressor and requires Java which I don't like.

bzitzow commented 9 years ago

Bump.

Font location: bower_components/font-awesome/fonts/custom-font-here.woff

non-compiled css location: bower_components/font-awesome/css/font-awesome.css

font reference path (in font-awesome.css): ../fonts/custom-font-here.woff

Compiled CSS stored in public/stylesheets/bower_components.css is reference ../fonts/custom-font-here.woff - 404 not found.

sbecker commented 9 years ago

Hi @bzitzow - Asset Packager is no longer being actively maintained. It was written in the Rails 1.X days. If you need to continue using it, I would suggest writing an additional rake task that copies your fonts to the path the compiled css expects it, which looks most likely to be: public/fonts/custom-font-here.woff