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

allow css-loader to resolve @imports #667

Merged
merged 1 commit into from
Nov 20, 2019

Conversation

magsallen
Copy link
Contributor

@magsallen magsallen commented Nov 20, 2019

We've run into a problem in the next-myft-page and next-article Page Kit migrations where the sass-loader plugin is unable to resolve imports with .css extensions. x-dash components output their styles as css so importing these stylesheets currently throws errors.

Setting this property in the cssLoaderOptions allows the css-loader to resolve these imports. Their contents can then be added to the concatenated public/styles.css bundle.

An alternative solution would be to update this regex so that the sass-loader is able to resolve .css files at that point instead.

Thoughts?

@magsallen magsallen requested review from apaleslimghost and a team November 20, 2019 12:09
@magsallen magsallen added Build tools Bug Something isn't working labels Nov 20, 2019
@magsallen magsallen merged commit 1386eee into master Nov 20, 2019
@magsallen magsallen deleted the maggie/update-css-loader-import-rule branch November 20, 2019 12:57
@i-like-robots
Copy link
Contributor

Just a note to say that the required behaviour should have been possible previously. Sass can lookup and include .css files as other Sass partials so long as the import meets the criteria here: https://sass-lang.com/documentation/at-rules/import#plain-css-imports

e.g.:

@import 'path/to/css-styles'; // will lookup file as a partial and try to include contents
@import 'path/to/css-styles.css';  // will compile to `@import url(path/to/styles.css);`

If it didn't work as shown above then we may need to raise a bug with an upstream dependency. See sass/libsass#754 also for more info about the original implementation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Build tools
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants