npm.io
1.0.2-alpha • Published 9 years ago

gulp-replace-important

Licence
Apache-2.0
Version
1.0.2-alpha
Deps
3
Vulns
0
Weekly
0
Stars
415

gulp-replace-important

Gulp plugin for replace-important. Plugin for removing !important from css rules from selectors and replacing them inside similar selectors - the new selectors will have the highest specificity in the CSS file. This is useful for making CSS Supported by AMPHTML. This plugin only supports Buffers, but stream support could be added with gulp-streamify.

Installation

As a dev dependency to your project

npm install --save-dev gulp-replace-important

Usage

const gulp = require('gulp');
const gulpReplaceImportant = require('gulp-replace-important');

/**
* Example:
* Input: body {background-color: red !important;}
*
* Output: body {}:root:not(#FK_ID) body{background-color: red }
*/
gulp.task('css:important', () => {
  return gulp.src('*.css')
    // Validate the input and attach the validation result to the "amp" property
    // of the file object.  
    .pipe(gulpReplaceImportant())
    .pipe(gulp.dest('gulp-replace-important-test'))
});

Tests

Tests can be run with:

npm run test

Contributing

Please see the CONTRIBUTING.md

License

Apache License 2.0

Keywords