thgh / rollup-plugin-scss

Rollup and compile multiple .scss, .sass and .css imports
MIT License
134 stars 47 forks source link

Keep imports for later loading #62

Open AndyOGo opened 3 years ago

AndyOGo commented 3 years ago

I build a component library and I only want to transform SCSS files to CSS files and keep the import statements renamed to the CSS file. The user of the library is then free to decide which loader he uses and how the CSS is delivered to the browser. Like @rollup/plugin-typescript does it, it also renames the imports from *.ts to *.js and generates the transpiled files.

Input:

- src
   index.js
   index.scss
import "./index.scss";

Output:

- dist
   index.js
   index.css
// change only the extension.
import "./foo.css";

I made a contrived example using the resolveId hook with the external option: https://repl.it/@AndyOGo/OldfashionedAnnualCache