cjohansen / juicer

A command line tool for JavaScript and CSS developers
631 stars 47 forks source link

juicer merge & external CSS #55

Open syelle opened 12 years ago

syelle commented 12 years ago

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?

cjohansen commented 12 years ago

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...