PostCSS plugin to use inline comments in CSS. The only thing I missed.
Please use postCSS-SCSS instead.
$ npm i postcss-inline-comment --save-dev
With Node.js:
var fs = require('fs'),
postcss = require('postcss'),
inlineComment = require('postcss-inline-comment');
var css = fs.readFileSync('style.css', 'utf8');
var output = postcss()
.use(inlineComment())
.process(css).css;
With Grunt via grunt-postcss
module.exports = function(grunt) {
grunt.initConfig({
postcss: {
options: {
processors: [
require('postcss-inline-comment')
]
},
dist: {
src: 'src/style.css',
dest: 'dest/style.css'
}
}
});
grunt.loadNpmTasks('grunt-postcss');
};
With gulp.js via gulp-postcss
var gulp = require('gulp');
var postCSS = require('gulp-postcss');
var postCSS_InlineComment = require('postcss-inline-comment');
gulp.task('postcss', function(){
gulp.src('src/style.css')
.pipe(postCSS([ postCSS_InlineComment() ]))
.pipe(gulp.dest('dest'));
});
.foo {
//margin: 0;
padding: 0;
}
you will get:
.foo {
padding: 0;
}
(But it's only works for declarations inside rules, yet.)
Nope.
Feel free to use it, but if you want work with SCSS syntax take a look at postCSS-SCSS.