Skip to content

Jokki57/gulp-cssmodules-map

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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));
});

About

Gulp plugin for creating map file with css modules, that can be used directly in you trinspiled code

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published