/postcss-at-debug

PostCSS plugin to keep nodes inside the @debug at-rule in debug mode and remove them in release mode

Primary LanguageJavaScriptMIT LicenseMIT

PostCSS At-Debug

Testing npm

PostCSS plugin to keep nodes inside the @debug at-rule in debug mode and remove them in release mode.

Install

npm install postcss-at-debug --save-dev

Usage

Debug mode

var postcss = require('postcss');
var debug = require('postcss-at-debug');

var fs = require('fs');

var mycss = fs.readFileSync('input.css', 'utf8');

var output = postcss([
		debug({
		    debug: true
		})
	])
	.process(mycss)
	.css;

console.log(output);

Input:

@debug {
    .body {
        color: red;
    }

    #root {
        background-color: blue;
    }
}

h1 {
    font-style: italic;
}

Output:

#root {
    background-color: blue;
}

.body {
    color: red;
}

h1 {
    font-style: italic;
}

Release mode

// ...

var output = postcss([
		debug({
		    debug: false
		})
	])
	.process(mycss)
	.css;

console.log(output);

Input:

@debug {
    .body {
        color: red;
    }

    #root {
        background-color: blue;
    }
}

h1 {
    font-style: italic;
}

Output:

h1 {
    font-style: italic;
}

Options

  • debug: boolean - flag for debug mode
    • Default: 'true'

Testing

npm test