0.0.1 • Published 7 years ago
gulp-cssmodules-map v0.0.1
Gulp plugin for extracting CSS module to JSON file using PostCSS
This plugin based on gulp-postcss-modules,
but you can pass custom generateScopedName
callback for postcss-modules plugin.
Usage
Basic
gulp.task('css-modules',
() => gulp.src('lib/**/*.css')
.pipe(cssModules())
.pipe(gulp.dest(options.defaultDir));
});
Custom generateScopedName
according to https://github.com/webpack/loader-utils#interpolatename
gulp.task('css-modules',
() => gulp.src('lib/**/*.css')
.pipe(cssModules(
'[name]__[local]___[hash:base64:5]',
))
.pipe(gulp.dest(options.defaultDir));
});
Also you can pass array of postcss plugin as second parameter, it will be passed directly to postcss module
gulp.task('css-modules',
() => gulp.src('lib/**/*.css')
.pipe(cssModules(
'[name]__[local]___[hash:base64:5]',
[
// init postcss plugins
]
))
.pipe(gulp.dest(options.defaultDir));
});
0.0.1
7 years ago