3.0.0 • Published 8 years ago

postcss-inline-comment v3.0.0

Weekly downloads
1,568
License
MIT
Repository
github
Last release
8 years ago

PostCSS Inline Comments Build Status Dependencies

PostCSS plugin to use inline comments in CSS. The only thing I missed.

It's depreacted

Please use postCSS-SCSS instead.

Installation

$ npm i postcss-inline-comment --save-dev

Usage

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'));
});

Using this 'style.css':

.foo {
  //margin: 0;
  padding: 0;
}

you will get:

.foo {
  padding: 0;
}

(But it's only works for declarations inside rules, yet.)

Options

Nope.

It is just a little hack

Feel free to use it, but if you want work with SCSS syntax take a look at postCSS-SCSS.