ENB tech to build a hash with entities as a key and array of CSS strings collected from all the levels as a value.
Default result is css.json
file with something like this:
{
"b1": [".b1 { color: red; }", ".b1 { font-size: 42px; }"],
"b2": [".b2 { color: green; }"]
}
Install enb-css-hash
package:
$ npm install --save-dev enb-css-hash
Requirements: enb 0.16.0+
.
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
}
}]
]);
});
};
© 2017 YANDEX LLC. Code released under the Mozilla Public License 2.0.