rollup-plugin-sass icon indicating copy to clipboard operation
rollup-plugin-sass copied to clipboard

:export for consumption of variables in JavaScript

Open svdoever opened this issue 4 years ago • 2 comments

I try to use the :export construct as described in https://stackoverflow.com/questions/61517117/cannot-export-sass-variables-into-javascript?noredirect=1&lq=1 to be able to use values of SASS variables in my JavaScript but can't get it working:

@import "variables";

:export {

    // Export the color palette to make it accessible to JS
    some-light-blue: $some-light-blue;
    battleship-grey: $battleship-grey;
    // etc...

}

Should this work with rollup-plugin-sass, or is there another method to accomplish this?

svdoever avatar Jun 04 '20 21:06 svdoever

Struggling with this exact same issue. Did you ever get it resolved?

gloverab avatar Dec 17 '20 23:12 gloverab

I'm also looking to see this work.

RossComputerGuy avatar Aug 14 '22 22:08 RossComputerGuy

Hi all, Turns out the plugin supported this all along: Example: https://github.com/elycruz/rollup-plugin-sass/blob/f4b2e6457ed52fb2b4ade58c9853ebf124396980/test/index.test.ts#L290-315

Closing issue as is duplicate of #72 .

elycruz avatar Sep 17 '22 18:09 elycruz

Correct example reference: https://github.com/elycruz/rollup-plugin-sass/blob/f4b2e6457ed52fb2b4ade58c9853ebf124396980/test/index.test.ts#L290-L315

elycruz avatar Sep 17 '22 18:09 elycruz