Skip to content

fanhaoyuan/vite-plugin-vars-modifier

Repository files navigation

vite-plugin-vars-modifier

A Plugins for convert variables from css preprocessor file.


English | 中文

Usage

Install

$> npm install vite-plugin-vars-modifier -D
#or
$> yarn add vite-plugin-vars-modifier -D

Use

Add following options in vite.config.js

import modifier from 'vite-plugin-vars-modifier';

export default {
    plugins: [
        modifier({
            paths: ['path/to/file'],
            type: 'less',
        }),
    ],
};

Options

export interface ModifierOptions {
    /**
     * paths for content to pass to parser.
     *
     * support glob format
     *
     * @see https://github.com/mrmlnc/fast-glob#readme
     */
    paths: string | string[];

    /**
     * Whether to remove the prefix
     *
     * @default true
     */
    strip: boolean;

    /**
     * Typeof parser of modifier
     */
    type: 'less' | 'scss';
}

relation

License

MIT