-
Notifications
You must be signed in to change notification settings - Fork 322
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect image paths #129
Comments
Hi @roelvanduijnhoven! The way we handle it in GoalSmashers.com is by using absolute URLs which is also a recommended way of referencing images from CSS files. It could be improved by turning URLs to absolute when using |
Thanks for your reply. How do you handle vendor libraries? Sure we can make sure our own stylesheets use absolute URLs, but most vendor libraries won't (for good reasons :)). |
If you keep input and output file in one directory then there's no problem, however we need to handle it somehow in other cases too. Consider your request accepted. |
Thanks! Just to clearify the use-case (and start a discussion?). Assume the following tree:
Now bundling I would say there are two obvious ways to get this done without moving files:
|
Exactly, @roelvanduijnhoven, that's how it should be done. Expect some work on it soon! |
About to start coding this feature. Basically there are four scenarios in clean-css:
|
Yes that look's right (and highly useful :)) One might consider throwing a warning saying the configuration is ambiguous when both using |
@roelvanduijnhoven all 4 options are covered now although there is still no warning if both For a binary it should be OK to output it to stderr but when used as a JS library something like We can also skip it for now and revisit in 1.2. |
We should definitely not delay this feature because of warning messages :)! Skip the thing and mention in the docs that the |
Sure, but we will have another ticket about unified way to report errors and warnings. We'll merge the changes later today so 1.1 could be out as soon as tomorrow. |
👍 |
…e path given by `root` option. win compatibility
@roelvanduijnhoven clean-css 1.1 is out with fix to this issue included. Thanks for helping us out! |
@roelvanduijnhoven Could you please post a more detailed description or example with which settings for your initial example this works and which URLs it produces? Thanks! |
To be honest: in the end we chose to move the images instead of rewriting the CSS using these techniques. A Gruntfile is used to do the following:
This works perfectly for us. |
How do you keep the list of images up-to-date? Could you provide an example Gruntfile based on the directory layout above and show me what gets copied where? |
Moving (or copying) the images files like @roelvanduijnhoven mentioned, to make them located in a path that will match the original CSS url()s might work in some cases, but when for example multiple packages would reference the same folder it can get messy. In these cases one still need to do some rewriting. |
I agree with @rawtaz, and messy doesn't begin to explain it when duplicate file locations & names come into play (i.e., files named |
For a project I am developing I want to bundle two CSS files from seperate directories into a file in a third directory. Each of these two source CSS files reference to images relative to their working directory. Obviously the paths are no longer correct after they have been bundled and stored in a third location.
I would expect clean css to rewrite the url's so the change of location is reflected. This could be either done by:
How can I accomplish this task? Or am I tackling the problem of bundling external libraries in a wrong way? Is the solution perhaps to just manually copy the needed assets to the correct location?
The text was updated successfully, but these errors were encountered: