@mlut/plugins
v1.0.2
Published
mlut plugins for Rollup, Vite and Webpack
Downloads
17
Maintainers
Readme
mlut plugins
The mlut plugins for Rollup, Vite and Webpack. Based on unplugin.
Installation
npm i -D @mlut/plugins sass-embedded
When using this package, you will need to install Sass separately. We recommend sass-embedded, but regular sass is also suitable.
This allows you to control the versions of all your dependencies, and to choose which Sass implementation to use.
Usage
Import the plugin for the appropriate bundler from the @mlut/plugins
package as in one of the examples below. You can find more detailed examples using dev-server and livereload in the plugin tests directory
Rollup
// rollup.config.js
import { rollup } from '@mlut/plugins';
const mlut = rollup({
output: 'dist/style.css',
// other options...
});
export default {
// rollup config...
plugins: [mlut],
};
Vite
// vite.config.js
import { vite } from '@mlut/plugins';
const mlut = vite({
output: 'dist/assets/style.css',
// other options...
});
export default defineConfig(() => {
return {
// vite config...
plugins: [mlut],
}
});
Webpack
// webpack.config.js
import { webpack } from '@mlut/plugins';
const mlut = webpack({
output: 'dist/style.css',
// other options...
});
export default {
// webpack config...
plugins: [mlut],
};
Options
The plugin options are similar to the mlut CLI options
interface Options {
output: string,
input?: string,
minify?: boolean,
autoprefixer?: boolean,
noMergeMq?: boolean,
}
output
- output CSS fileinput
- input Sass file when you import mlut, configure it and write other CSSminify
- generate minified CSS. For this option to work, you need 1 of the following minifiers: csso, lightningcss, clean-css, cssnano or esbuild. You may already have it installed. When usinglightningcss
, you will also need to install browserslistautoprefixer
- whether to add vendor prefixes to CSS properties. You need the autoprefixer package or lightningcss for this option to worknoMergeMq
- prevent merging of CSS media queries during minification. Relevant only when using the csso minifier
You can add the options in your input Sass file too. Options must be a valid JSON, but single quotes is allowed. Paths will be resolved relative to the JIT engine working directory
@use '@mlut/core' with (
$jit: (
'output': 'dist/assets/style.css',
'minify': true,
'autoprefixer': true
),
);
Documentation
Full documentation available here
License
MIT