Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Inject global scss files before processing styles #146

Closed
manuschillerdev opened this issue Sep 3, 2020 · 1 comment
Closed

Inject global scss files before processing styles #146

manuschillerdev opened this issue Sep 3, 2020 · 1 comment

Comments

@manuschillerdev
Copy link

thanks for the great plugin!

Is it possible to inject several scss imports to every scss file before processing it?
In our webpack project we use sass-resoucres-loader for that, so we do not need to manually import the helpers in every *.scss file:

{
    loader: 'sass-resources-loader?sourceMap',
    options: {
      resources: [
        resolve(rootDir, 'src/app/styles/utils/rem-to-px.scss'),
        // ...
      ],
    },
  },

src/app/styles/utils/rem-to-px.scss

@function rem($size) {
  $remSize: $size / 16px;
  @return #{$remSize}rem;
}

MyComponent.scss

// note: no explicit import of rem-to-px.scss here
.MyComponent {
  width: rem(24px);
}

is this possible with this or any other rollup plugin right now?
Thanks again!

@pollys2217
Copy link

pollys2217 commented Jan 19, 2021

Hi! I use the following settings in my project:

rollup.config.js

styles({
         sass: {
            data: `
               @import "${path.join(__dirname, "src/styles/variables.scss")}";
            `,
         },
}),

Repository owner locked and limited conversation to collaborators Jan 19, 2021

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants