juicer icon indicating copy to clipboard operation
juicer copied to clipboard

juicer merge & external CSS

Open syelle opened this issue 13 years ago • 1 comments

I have my css files stored in [PROJECT_PATH]/assets/css in my project. One of my CSS files imports from Google Fonts:

@import url(http://fonts.googleapis.com/css?family=Open+Sans:400,600,800);

When Juicer attempts to merge without a document root specified, it gives an error that I need to specify a document root:

> juicer -v merge assets/css/main.css --force
gems/juicer-1.0.16/lib/juicer/dependency_resolver/dependency_resolver.rb:42:in `resolve_path': Cannot resolve absolute path 'http://fonts.googleapis.com/css' without document root option (ArgumentError)

If I specify document root, Juicer throws another error related to not being able to find a /css directory:

> juicer -v merge assets/css/main.css --force -d .
gems/juicer-1.0.16/lib/juicer/dependency_resolver/dependency_resolver.rb:68:in `foreach': No such file or directory - [PROJECT_PATH]/css (Errno::ENOENT)

I'm executing the above from my project root. If I try an absolute path for the project root, I still get the same error.

Should I be using different syntax? Is there a way to get Juicer to ignore this input short of separating it into a CSS file that juicer isn't tasked with minifying and merging?

syelle avatar Jul 14 '12 20:07 syelle

I guess Juicer should probably ignore external URLs. Right now, the best approach I can think of is to put that statement in its own file, and use cat to combine it with the one Juicer builds. Not exactly optimal, I know...

cjohansen avatar Jul 15 '12 20:07 cjohansen