postcss-ignore

PostCSS plugin let specific css lines and rules untouched by other plugins

Usage no npm install needed!

<script type="module">
  import postcssIgnore from 'https://cdn.skypack.dev/postcss-ignore';
</script>

README

PostCSS Ignore

GitHub license

PostCSS plugin to let specific css lines and rules untouched by other plugins.

DISCLAIMER: Only tested with Gulp workflows & !ignore flag breaks css if not removed (by this plugin) - usage on own risk so far. If anyone have some ideas e.g. how it would be possible to flag the decl without breaking it - feel free to contribute or find me on Twitter :)

.foo {
    /* Input example */

    z-index: 1337 !ignore;
}
.foo {
  /* Output example */

  z-index: 1337;
}

Usage

First things first:

$ npm install postcss-ignore

Gulp:


gulp.task('scss', function() {
    gulp.src('src/css/*.css')
        .pipe( postcss([ 
            ignore() // <- hide flagged declarations
            
            // other plugins
            
            ])
        )
        
        // maybe some more things
        
        .pipe( postcss([ 
            ignore('last') // <- **unhide** flagged declarations
        ]) )
        .pipe( gulp.dest('dist/css/'))
        .pipe( reload({stream:true}));
});

Note that the ignore('last') call has to be in an other pipe than the initial.