-
Notifications
You must be signed in to change notification settings - Fork 147
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
Wrong paths in source map #248
Comments
Did you try to set the |
The Other developers with this problem appear to be using text replacement tasks to replace the paths when cssmin is done. It's a bad solution, but I don't know of a better one. |
Hmmm… not sure about that. But this is the configuration I used:
|
The map file is saved to the correct directory, but the problem is that the paths to the original source files (LESS, Sass, etc.) within the map file are incorrect. For example, let's say I have an app/css directory and my Gruntfile.js is outside of app. When I build my files for production, the CSS files will reside at dist/css. The cssmin task will minify the files and generate the source maps as expected in the dist/css directory; however when I use the browser dev tools to view the original LESS/Sass files, they aren't there, because the map file still references them at the path app/css instead of dist/css. I believe that is the issue the OP is describing as well. There needs to be a way to specify a root path for the referenced source files within the source map file. Currently, this can only be done with a find/replace on the source map files after the cssmin task runs. |
Ok, I think I didn't understand you (until now; thanks for clarification btw), but I think I tried to do the very same and succeeded. What's your config for |
Here's a simplified version of my configuration.
I used "root" for the The source map that gets generated begins with the following:
I need those paths to be "/stylesheets/partials/_resets.scss" and "/stylesheets/partials/_base.scss". |
Where do these paths come from? Are they commented in |
No, .tmp/main.css and .tmp/main.css.map are compiled by Sass/Compass from the files in the app/stylesheets directory. It looks like the issue may not be with cssmin but with the source map generated by Compass. The cssmin task is just copying over the same source map (including file paths) that Compass generated. I'll need to do some digging to see if I can control that within Compass. Thanks for your help. |
@thomashigginbotham , in my case I have no Compass - specifically disabled sourceMap generation. The only source of sourceMap is created inside cssmin. I still have your exact situation. I think the default behavior should be setting sources as the destination path, not the src path. |
I have this problem too. For example: If i manually add a "/" to the beginning of all paths in the generated maps, it works perfectly in the browser. Something relative ,like: When uglify generates maps, it does it right, but uses realtive paths. I don't see how it can work in cssmin, the way its done now. Is anyone getting functioning maps out of cssmin,, without any hacks? |
Is this still an issue? |
It's still an issue. I'm currently using grunt-sass, grunt-postcss, and grunt-contrib-cssmin. I compile sass from a source to .tmp folder where the sourcemap is created. Then I use grunt-postcss to add vendor prefixes and update sourcemap. Up until that point the sourcemap is referenced correctly back to its source file. But when I run cssmin, .tmp to a dist folder the sourcemap is modified my cssmin to point to the .tmp folder. I would like to keep the original source folder and not the .tmp. I tried root and that didn't work.
|
Please try to make a PR to address the issue and CC me. |
Is this fixed? |
My project structure is like this:
In the Gruntfile.js I have
In the HTML, I call the stylesheet with
BUT in the output however, I get the path to font-awesome in the sourcemap being;
instead of
The text was updated successfully, but these errors were encountered: