stackcss / sheetify-variables

Spec compliant CSS variables syntax for sheetify

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

sheetify-variables

NPM version build status Test coverage Downloads

A sheetify transform to add support for W3C-style CSS variables syntax. Uses rework-vars to perform the transformation.

N.B. This is not a polyfill. This transform aims to provide a future-proof way of using a limited subset of the features provided by native CSS variables.

Installation

npm install sheetify-variables

Usage

As a sheetify transform:

var variables = require('sheetify-variables');
var sheetify = require('sheetify');

sheetify('path/to/my/index.css')
  .transform(variables({preserve: true}))
  .bundle();

Options

map

Optionally, you may pass an object of variables to the JavaScript function.

var myVars = {
  'app-bg-color': 'white'
};

variables({map: myVars});

preserve

Setting preserve to true will preserve the variable definitions and references in the output, so that they can be used by supporting browsers.

variables({preserve: true});

License

MIT

About

Spec compliant CSS variables syntax for sheetify

License:MIT License


Languages

Language:JavaScript 100.0%