Skip to content
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

Resolving "like a module" using postcss-import #209

Closed
paulyoung opened this issue May 9, 2016 · 2 comments
Closed

Resolving "like a module" using postcss-import #209

paulyoung opened this issue May 9, 2016 · 2 comments

Comments

@paulyoung
Copy link

We're using the feature css-loader feature described in webpack-contrib/css-loader#12 (comment) to allow @imports to be resolved "like a module" by prefixing them with ~.

For example:

@import "../../node_modules/normalize.css/normalize.css";

is instead written as:

@import "~normalize.css/normalize.css"

This stops working when using postcss-import. Is there a way to allow this to continue to work?

@MoOx
Copy link
Contributor

MoOx commented May 9, 2016

postcss-import already handle node_modules.
You can do

@import "normalize.css"

This will inline CSS so css-loader won't see any imports after you use this plugin.

@paulyoung
Copy link
Author

Thanks! In our case we are importing specific files so all I needed to do was change:

@import "~foo/bar.css";

to:

@import "foo/bar.css";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants