Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

postcss-strip-inline-comments

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

postcss-strip-inline-comments

Strip inline comments using the postcss-scss parser

  • 0.1.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
8.6K
decreased by-20.3%
Maintainers
1
Weekly downloads
 
Created
Source

PostCSS strip inline comments Build Status

A plugin to remove inline CSS comments from compilation.

/* This comment will remain */
// This comment will be removed
body {
    // This comment will also be removed
    background-color: black;
}
// And so will this one

Usage

You need to have a compliant parser, currently either postcss-scss or sugarss already parsing your postcss for this plugin to work.

###Install

npm install postcss-strip-inline-comments --save-dev

###Grunt

grunt.initConfig({
  postcss: {
    options: {
      processors: [
        require('postcss-strip-inline-comments'),
      ],
      syntax: require('postcss-scss')
    },
    dist: {
      src: 'css/*.css'
    }
  }
});

###Gulp

var gulp = require('gulp');
var postcss = require('gulp-postcss');
var stripInlineComments = require('postcss-strip-inline-comments');
var scss = require('postcss-scss');

gulp.task('default', function () {
    var processors = [stripInlineComments];
    return gulp.src('in.css')
        .pipe(postcss(processors, {syntax: scss}))
        .pipe(gulp.dest('out'));
});

###Webpack

var stripInlineComments = require('postcss-strip-inline-comments');

var config = {
  ...

  module: {
    loaders: [
      { 
        test: /\.s?css$/,
        loader: ExtractTextPlugin.extract('style-loader', 'css-loader?sourceMap&importLoaders=1!postcss-loader?parser=postcss-scss')
      }
    ]
  },
  postcss: function(webpack) {
    return [
      stripInlineComments
    ];
  },
  ...
}

###Node

import postcss from 'postcss';
import syntax from 'postcss-scss';
import stripInlineComments from 'postcss-strip-inline-comments';

let css = fs.readFileSync('style.css', 'utf8');

postcss([stripInlineComments]).process(css, { parser: syntax }).then( result => {
    console.log(result.css);
});

Keywords

FAQs

Package last updated on 14 Jul 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc