-
Notifications
You must be signed in to change notification settings - Fork 37
Update relative URLs to point to correct location #12
Comments
Hello ottok, No, uglifycss doesn't parse or update relative paths. Relative paths should be relative to the output location. |
Currently I use PHP Minify (https://code.google.com/p/minify/) but I'd like to migrate to using UglifyCSS and UglifyJS. The only showstopper at the moment is that UglifyCSS does not support the ability to input multiple CSS files from different subfolders and minify them together. Could this question please be reopened as a feature request? |
Uglifycss can minify several css files at a time indeed. Isn't it a matter of bundles (with a stylesheet and images) where image paths in css stylesheets should be parsed then updated relatively to the output target? If so, I don't plan to implement this feature but perhaps someone could... |
@ottok Please have a look at https://github.com/kriswallsmith/assetic and specially https://github.com/kriswallsmith/assetic/blob/master/src/Assetic/Filter/CssRewriteFilter.php |
@sstok Thanks but I already have a PHP solution that I would like to replace with Node.js-based solution, hence having this fixed in Uglify.js is more interesting to me than Assetic or PHP minify. But yes, reading that link or the PHP minify source could lead to a faster implementation.. |
We would also like to see relative URLs automatically fixed if final CSS is in another Location than the Original CSS Files ... Andreas Schnederle-Wagner |
With the option "--convert-urls d", relative urls are converted according to the d directory. Probably buggy on Windows Ref: #12
@fmarcia - That's good News indead - I will test is as soon as NPM got the new 0.0.22 Package! ;-) |
@futureweb I just published changes on npm. Your test report is welcome, especially if you run it on windows |
@fmarcia - already struggle with first tests :-/ uglifycss --convert-urls /test/ test.css > test-gen.css ?! |
The right syntax is |
|
@futureweb, |
|
@futureweb, I made some tests with your css and couldn't reproduce the error you specified. I guess it may be because of the nodejs version but I'm not that sure. I committed last night a version which displays the full error stack when an error occurs. Could you |
@fmarcia - there you go:
maybe it would be beneficial if official Version also got Option to Output Full Error Stack? (maybe with --verbose / --debug Parameter or something like that?) |
Thank for your help, @futureweb. |
@fmarcia - you are right - that's the cause of the Problem. Also getting Error when executing fill on node promt. |
@futureweb, I'll publish a new version on npm tonight. |
@fmarcia - you are welcome - thx for this quick fix! ;-) |
@fmarcia - found another little Bug ;-)
becomes:
--> uglifycss-lib.js --> Line: 116 - check for "/" is the Problem. Possibilities:
Guess that's all? |
I hope so! |
@fmarcia - alright - just did some tests - and it's looking pretty good now! ;-) Will deploy on live server when NPM is updated |
Hello,
If I run something like
.. but in the resulting CSS many of the images will point to wrong locations, eg. '../img/xyz.png' when it should be 'adminbar/img/xyz.png'.
Is UglifyCSS supposed to update relative URLs so that the point to the correct location?
The text was updated successfully, but these errors were encountered: