A PostCSS plugin to add clearfix in one line.
npm install postcss-clear-fix
div.container {
clear: fix
}
will produce
div.container:after {
content: " ";
display: table;
clear: both
}
Using Gulp.
var gulp = require('gulp'),
postcss = require('gulp-postcss'),
clearfix = require('postcss-clear-fix');
gulp.task('css', function() {
gulp.src('path/to/dev/css').
.pipe(postcss({
// use it after nesting plugins
clearfix
}))
.pipe(gulp.dest('path/to/build/css'));
});
// rest of the gulp file