Absolute paths#15
Absolute paths#15mightyaleksey wants to merge 2 commits intocss-modules:masterfrom mightyaleksey:absolute-paths
Conversation
…otDir in order to build shorter generic names
|
Hey @sullenor, sorry I haven't looked at this PR yet. I've just had a look through the diff here and on css-modules/css-modules-loader-core#25 So the bug is to do with importing from files inside node_modules? Or is specifically to do with postcss-url? Trying to figure out why this needs to have breaking changes to this module.... |
|
In beginning, I found that problem, when I tried to work with The css-loader creates a single pipeline for each processing file and provides file content and file path to it. File path affects the source property of nodes in the result CSS tree which is used by plugins. I found out that css-loader provides short paths to the pipeline: https://github.com/css-modules/css-modules-loader-core/blob/master/src/index.js#L17 which are not relevant to the original file. So the plugins which use provided file path to resolve paths in the code don't work. Also it may result in generating wrong source maps. I decided to fix it by providing relevant paths here: https://github.com/css-modules/css-modules-loader-core/blob/master/src/index.js#L17 |
|
Also, I made a quick solution as another postcss plugin which fixes paths: https://github.com/sullenor/todos/blob/master/postcss-fix-paths.js I use it load icons from the font-awesome package |
I think we should provide real paths using config.from. Will be easier to use CSS Modules core plugins together with the other postcss plugins.
Also loader-core should be updated.