css-variables-loader

2.0.2 • Public • Published

CSS variable loader

npm Build Status Dependency Status

Import your CSS variables into JavaScript.

Assumptions

This project assumes you use W3C custom properties for CSS variables. This is how they look:

:root {
    --my-theme-color: hsl(12190%90%);
    --my-accent-color: hsl(6090%90%);
    --my-font-size: 18px;
}

Only the custom properties on the :root selector are currently supported.

This project also assumes you have a Webpack-like setup for building your application.

Usage

Install the loader into your project with npm install --save css-variables-loader.

In your JavaScript, use var variables = require('!css-variables!../path/to/variables.css').

Now variables is a map of variable names to values as strings.

Readme

Keywords

none

Package Sidebar

Install

npm i css-variables-loader

Weekly Downloads

2,143

Version

2.0.2

License

ISC

Last publish

Collaborators

  • swauquier
  • bastien.granger
  • guillaumemarondashlane
  • dashlaneqbarbe
  • denis-sokolov
  • tregagnon