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

@use rules must be written before any other rules. #70

Open
jrkarlsson opened this issue Mar 11, 2021 · 6 comments
Open

@use rules must be written before any other rules. #70

jrkarlsson opened this issue Mar 11, 2021 · 6 comments

Comments

@jrkarlsson
Copy link

It would nice to be able to use sass/dartsass and the at-rules, especially the @use since @import has been deprecated(https://sass-lang.com/documentation/at-rules/import). However doing so will most likely yield a compilation error: "@use rules must be written before any other rules."

I looked a bit at the code and it seems like the plugin is concatenating all the scss partials and then compiling it to css. By doing so @use rules will end up in the middle of the concatenated string which yields the error.

I created a small repo to reproduce the issue: https://github.com/jrkarlsson/rollup-plugin-scss-issue

@ivannovazzi
Copy link

Any update on this? This is preventing my library to build.

@thgh
Copy link
Owner

thgh commented May 31, 2021

I'm not planning to work on this issue, but PRs welcome!

@onyxcodes
Copy link

onyxcodes commented Oct 26, 2022

I've made some edits to parse correctly @use rules: https://github.com/onyxcodes/rollup-plugin-scss/tree/use-rules.

Had to add a config basePath to be able to resolve paths when using ~. But by default it will use the root directory of the rollup configuration.

@thgh what do you think?

@thgh
Copy link
Owner

thgh commented Oct 27, 2022

PR welcome!

Let's make a v4 with Rollup 3 support, emitFile and this

@thgh
Copy link
Owner

thgh commented Dec 21, 2022

@onyxcodes Can you explain me what you mean with the additional features (Rollup 3 compatibility and emitFile).. in case I may help with those too.

Hi Onyx,

You can make a pull request from this page. That will create an entry in the list of pull requests. From there, I and other people can easily review your changes. When everything looks good, we will merge the changes in the v3 branch.

There is also a v4 branch recently using "emitFile" from Rollup which allows for smarter filenames of assets like css files.

Looking forward to your PR!

@FrankGi1
Copy link

Hey, sorry came late to the party, was the PR created?
Is there any fix for this issue, I am facing the same and wonder if there is a work around?

Thanks!

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

5 participants