Ready to take your JavaScript development to the next level? Meet npm Enterprise - the ultimate in enterprise JavaScript. Learn more »

postcss-words

1.0.1 • Public • Published

Words PostCSS Logo

NPM Version Build Status Licensing Changelog Gitter Chat

Words lets you transform CSS words into custom values in CSS.

{
    "midnight-moss": "#041004",
    "red": "#ce2029"
}
/* before */
 
.hero {
    box-shadow: 0 0 0 0 midnight-moss;
    background-color: red;
    color: blue;
}
 
/* after */
 
.hero {
    box-shadow: 0 0 0 0 #041004;
    background-color: #ce2029;
    color: blue;
}

Options

words

Type: Object|String
Default: .csswords.json

The file or object to reference when updating CSS words.

functions

Type: Array|String
Default: ["url"]

A list of functions to avoid parsing within.

Usage

Add Words to your build tool:

npm install postcss-words --save-dev

Node

require('postcss-words').process(YOUR_CSS, { /* options */ });

PostCSS

Add PostCSS to your build tool:

npm install postcss --save-dev

Load Words as a PostCSS plugin:

postcss([
    require('postcss-words')({ /* options */ })
]).process(YOUR_CSS, /* options */);

Gulp

Add Gulp PostCSS to your build tool:

npm install gulp-postcss --save-dev

Enable Words within your Gulpfile:

var postcss = require('gulp-postcss');
 
gulp.task('css', function () {
    return gulp.src('./src/*.css').pipe(
        postcss([
            require('postcss-words')({ /* options */ })
        ])
    ).pipe(
        gulp.dest('.')
    );
});

Grunt

Add Grunt PostCSS to your build tool:

npm install grunt-postcss --save-dev

Enable Words within your Gruntfile:

grunt.loadNpmTasks('grunt-postcss');
 
grunt.initConfig({
    postcss: {
        options: {
            use: [
                require('postcss-words')({ /* options */ })
            ]
        },
        dist: {
            src: '*.css'
        }
    }
});

install

npm i postcss-words

Downloadsweekly downloads

0

version

1.0.1

license

CC0-1.0

homepage

github.com

repository

Gitgithub

last publish

collaborators

  • avatar
Report a vulnerability