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

Is there a way to support "@use" from sass? #304

Open
larrotta69 opened this issue Aug 13, 2020 · 5 comments
Open

Is there a way to support "@use" from sass? #304

larrotta69 opened this issue Aug 13, 2020 · 5 comments

Comments

@larrotta69
Copy link

I know sass is currently using dart-sass which supports "@use": https://sass-lang.com/documentation/at-rules/use

Here is my rollup configuration:

postcss({
  plugins: [autoprefixer()],
  extract: false,
  modules: true,
  use: ["sass"]
})

But if I use this in the scss file

@use "./vars.module";

.header {
  height: vars.$size-base;
}

I got (plugin postcss) Error: Invalid CSS after " height: vars": expected expression (e.g. 1px, bold), was ".$size-base;"

It does work perfectly using @import but it will be deprecated

@import "./vars.module";

.header {
  height: $size-base;
}
@yaquawa
Copy link

yaquawa commented Sep 30, 2020

Same issue here, switched to this plugin solved the problem.
You can specify the sass compiler by yourself.

https://github.com/thgh/rollup-plugin-scss

@Mister-Hope
Copy link

Mister-Hope commented Jan 7, 2021

Same issue here, switched to this plugin solved the problem.
You can specify the sass compiler by yourself.

https://github.com/thgh/rollup-plugin-scss

How can I specify it?

Edit: Do you mean stop using rollup-plugin-postcss and using roll-up-plugin-scss instead?

@yaquawa
Copy link

yaquawa commented Jan 7, 2021

Do you mean stop using rollup-plugin-postcss and using roll-up-plugin-scss instead?

yes.

@Mister-Hope
Copy link

Mister-Hope commented Jan 7, 2021

Thanks for your reply. But how can I bundle styles in js with roll-up-plugin-scss? I did not find a way to do it. I saw your issue in vuejs/rollup-plugin-vue#410 Do you find out a way to output one js file with vue using scss?

@yaquawa
Copy link

yaquawa commented Jan 9, 2021

I couldn't find a way to inject css into js.

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

3 participants