Skip to content

funcss-lang/postcss-javascript-output

Repository files navigation

PostCSS Javascript Output Build Status

PostCSS plugin that can be used by other plugins for outputting JavaScript code.

postcss-javascript-output enables you to write plugins like this:

module.exports = postcss.plugin('postcss-helloworld', function () {
    return function (css, result) {
        result.addJS("console.log('Hello world')");
    };
});

Usage

var postcss = require('postcss');
postcss([ require('postcss-javascript-output')(), require('postcss-helloworld')() ])
    .process(css, { from: 'src/app.css', to: 'app.css' })
    .then(function (result) {
        fs.writeFileSync('app.css', result.css);
        if ( result.js ) fs.writeFileSync('app.js', result.js);
        if ( result.map ) fs.writeFileSync('app.css.map', result.map);
    });

See PostCSS docs for examples for your environment.

About

PostCSS plugin that enables other plugins to output JavaScript code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published