1.1.1 • Published 23 days ago

rollup-plugin-less-vars-to-css-vars v1.1.1

Weekly downloads
-
License
MIT
Repository
github
Last release
23 days ago

npm size libera manifesto

rollup-plugin-less-vars-to-css-vars

Less-to-CSS Variable Aggregator is an intelligent plugin designed to automate the process of converting variables from Less to CSS. It scans your project for all declared variables in Less files and transforms them into readable CSS variables. This plugin not only simplifies style management but also ensures more efficient use of variables, reducing development time and improving overall code structure.

Requirements

This plugin requires an LTS Node version (v14.0.0+) and Rollup v1.20.0+.

Install

npm install rollup-plugin-less-vars-to-css-vars --save-dev

Usage

Create a rollup.config.js configuration file and import the plugin:

import { exportLessVars } from "rollup-plugin-less-vars-to-css-vars";
const config = {
  input: "src/index.js",
  output: {
    dir: "output",
    format: "es",
  },
  plugins: [exportLessVars({ output: "theme.css" })],
};

export default config;

Then call rollup either via the CLI or the API.

Options

exclude

Type: Array[...String|RegExp]

A picomatch pattern, or array of patterns, which specifies the files in the build the plugin should ignore.

output

Type: String Default: variables.css

CSS filename

Example

import { exportLessVars } from "rollup-plugin-less-vars-to-css-vars";
const config = {
  input: "src/index.js",
  output: {
    dir: "output",
    format: "es",
  },
  plugins: [exportLessVars({ output: "theme.css" })],
};

export default config;
@primary-color: #0000ff;
@text-color: #594c4a;

body {
  color: @text-color;
}
/* theme.css */
:root {
  --primary-color: #0000ff;
  --text-color: #594c4a;
}

Meta

LICENSE (MIT)

1.1.1

23 days ago

1.1.0

23 days ago

1.0.1

24 days ago

1.0.0

30 days ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago