@mlut/plugins
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

mlut plugins

Logo

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 file
  • input - input Sass file when you import mlut, configure it and write other CSS
  • minify - 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 using lightningcss, you will also need to install browserslist
  • autoprefixer - whether to add vendor prefixes to CSS properties. You need the autoprefixer package or lightningcss for this option to work
  • noMergeMq - 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

/@mlut/plugins/

    Package Sidebar

    Install

    npm i @mlut/plugins

    Weekly Downloads

    0

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    13 kB

    Total Files

    6

    Last publish

    Collaborators

    • mr150