css-custom-property-extractor

0.1.6 • Public • Published

css-custom-property-extractor

npm version GitHub Actions status

Intro

  • Parse css custom properties and output typescript files.By importing the output typescript files
    ,custom properties can be used type-safely in various libraries.
  • Supports css and sass and less.

Usage

  1. Install as devDependencies
npm i -D css-custom-property-extractor
  1. For example. Parsing ./samples/scss/bootstrap.scss outputs the following typescript file.
npx ccpe -i ./samples/scss/bootstrap.scss
/**
 *  #0d6efd;
 */
export const bsBlue = "var(--bs-blue)"
/**
 *  #6610f2;
 */
export const bsIndigo = "var(--bs-indigo)"
/**
 *  #6f42c1;
 */
export const bsPurple = "var(--bs-purple)"
...
  1. Import and use the output typescript file.

Command options

option description
-o <path> output path.
-i,--include include path (glob pattern). (default */.?(css | scss | sass | less))
-e,--exclude exclude path (glob pattern).
-v,--vite <path | false> Specify the relative path to vite.config.
Read the css-preprocessoroptions property from vite.config. (default false)

Package Sidebar

Install

npm i css-custom-property-extractor

Weekly Downloads

3

Version

0.1.6

License

MIT

Unpacked Size

19.9 kB

Total Files

7

Last publish

Collaborators

  • mustache-master