gulp-scope-css

A plugin for Gulp

gulp-scope-css

Gulp plugin to scope your CSS selectors with an additional level

Adding additional depth to selectors should usually be avoided. In rare circumstances (such as building CSS as part of a reusable library) it's sometimes helpful to be able to add scope to all of your selectors so that your styles can be confined to certain sections of the page.

First, install gulp-scope-css as a development dependency:

npm install --save-dev gulp-scope-css

Then, add it to your gulpfile.js:

var scopeCss = require("gulp-scope-css");
 
gulp.src("./src/*.css")
    .pipe(scopeCss('.scope'))
    .pipe(gulp.dest("./dist"));

MIT License