UNPKG

723 BJavaScriptView Raw
1const path = require('path');
2const hook = require('css-modules-require-hook');
3const stylus = require('stylus');
4
5module.exports = (sections, meta, callback) => {
6
7 // Add stylus require hook
8 hook({
9 generateScopedName: meta.cssScopedName,
10 extensions: ['.styl'],
11 preprocessCss: function (css, filename) {
12 return stylus(css)
13 .set('filename', filename)
14 .render();
15 }
16 });
17
18 var styles = require(path.join(meta.theme, 'css/index.styl'));
19
20 // Add isolate scope css classes
21 styles['isolate-scope-root'] = meta.isolateScopeCssWrapperClass;
22 styles['isolate-scope'] = meta.isolateScopeCssClass;
23
24 // Create unique class name map
25 meta.cssMap = styles;
26 callback(null, sections);
27}
\No newline at end of file