PostCSS plugin for targeting all button elements with
:any-button
selector
/* before */
.form :any-button {
border: 0;
}
/* after */
.form button,
.form input[type="button"],
.form input[type="reset"],
.form input[type="submit"] {
border: 0;
}
npm install --save-dev postcss-pseudo-class-any-button
var fs = require('fs');
var postcss = require('postcss');
var anyButton = require('postcss-pseudo-class-any-button');
var css = fs.readFileSync('input.css', 'utf8');
var output = postcss([anyButton])
.process(css)
.css;
var gulp = require('gulp');
var postcss = require('gulp-postcss');
var anyButton = require('postcss-pseudo-class-any-button');
gulp.task('css', function () {
return gulp.src('./src')
.pipe(postcss([
anyButton
]))
.pipe(gulp.dest('./dist'));
});
MIT