vite-plugin-css-mila
v2.1.1
Published
Vite plugin to minify CSS
Downloads
16
Maintainers
Readme
Description
Vite plugin for minimizing css. Clean-CSS is used for minification.
- Minifies CSS.
- Copies CSS files.
- Rebase any URLs.
Install
yarn add -D vite-plugin-css-mila
Sample vite.config.js
import { defineConfig } from 'vite';
import CssMila from 'vite-plugin-css-mila';
export default defineConfig ({
/**
* Root directory.
* Required.
*/
root: './src',
plugins: [
CssMila(/* options */)
]
});
Options
{
/**
* Write output to console.
* Default: true.
*/
verbose: true,
/**
* Path to output directory.
* Required.
*/
outDir: '../dist',
/** Clean-CSS minify options, https://github.com/clean-css/clean-css
*/
minifyOptions: {},
/**
* List of files to process.
* Default: {}.
*/
targets: {
'target.css' : 'source.css',
'example/target.css': 'example/source.css'
},
/**
* Rebase any URL.
*
* From:
* "@import url("../example/source.css");"
*
* To:
* "@import url("/dist/source.css");"
*
* Default: {}.
*/
rebase: {
'../example/source.css': '/dist/source.css'
}
}