I know that Rollup is used to bundle .js files. But is it possible to use it just to process css? (css, scss, less, etc). What i mean is if i had for example in my src folder (the entry folder) a file called index.css and i want rollup to precess it at dist folder (the output folder) like index.css (but processed, for example if there is an imported .sass file or css variables). How can i do this?
Example rollup.config.js
import { uglify } from 'rollup-plugin-uglify'
import babel from 'rollup-plugin-babel'
import resolve from 'rollup-plugin-node-resolve';
import postcss from 'rollup-plugin-postcss'
const config = [
{
input: 'src/styles/index.scss',
output: {
file: 'dist/style.css',
name: "style",
},
plugins: [
postcss({
plugins: []
})
]
},
];
export default config
src/index.scss:
@import 'other';
h1 {
color: green;
}
src/other.scss
h2 {
color: red;
}
and in the dist folder should be an index.css with the all the code for both css files (and processed). Something like this: dist/index.css
h1 {
color: green;
}
h2 {
color: red;
}
file
, I get always the warningThe emitted file "Filename.css" overwrites a previously emitted file of the same name.
And if I use thedir
option instead of thefile
option, I got also an almost empty js file. Is there a way to avoid the warning or not to write the js file? – Pax