Skip to content

Latest commit

 

History

History
53 lines (42 loc) · 1.68 KB

README.md

File metadata and controls

53 lines (42 loc) · 1.68 KB

enb-css-hash

ENB tech to build a hash with entities as a key and array of CSS strings collected from all the levels as a value.

NPM version Build Status Coverage Status Dependency Status

Default result is css.json file with something like this:

{
    "b1": [".b1 { color: red; }", ".b1 { font-size: 42px; }"],
    "b2": [".b2 { color: green; }"]
}

Installation

Install enb-css-hash package:

$ npm install --save-dev enb-css-hash

Requirements: enb 0.16.0+.

Quick start

module.exports = function(config) {
    config.nodes('*.bundles/*', function(nodeConfig) {
        nodeConfig.addTechs([
            [require('enb-css-hash'), {
                sourceSuffixes: ['css'],
                target: 'css.json',
                processor: function(filename) {
                    console.log(this._processorOptions); // { life: 42 }
                    return fs.readFileSync(filename, 'utf8');
                },
                processorOptions: {
                    life: 42
                }
            }]
        ]);
    });
};

License

© 2017 YANDEX LLC. Code released under the Mozilla Public License 2.0.