thgh / rollup-plugin-scss

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

Add possibility to only transform scss to css #48

Open vladshcherbin opened 4 years ago

vladshcherbin commented 4 years ago

👋 Hey, it would be nice to be able to just transform scss to css. It's needed when you have another rollup plugins which expect plain css contents.

plugins: [
  scss(),
  processCss()
]

With current output: false it transforms it to js module with export default. It can be output: 'emit' or smth.

thgh commented 4 years ago

Good idea, PR welcome!

thgh commented 4 years ago

Note however, you can use scss({ processor: css => processCss(css) })

SunHuawei commented 8 months ago

I think @vladshcherbin means something else.

Here is an example. I have a js file importing a SCSS file like this

// index.js
import './index.scss';
...
// index.scss
app {}

After translating, I expect the files in dist/ would look like

// index.js
import './index.css';
...

and

// index.css
app {}

Notice that the output CSS file name is index.css rather than index.scss.js. The content of the CSS file should be in plain CSS rather than anything in JS format.