Skip to content

ENB tech to build a hash with entities as a key and CSS inlined as a value

License

Notifications You must be signed in to change notification settings

tadatuta/enb-css-hash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

ENB tech to build a hash with entities as a key and CSS inlined as a value

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published