PostCSS plugin to keep nodes inside the @debug at-rule in debug mode and remove them in release mode.
npm install postcss-at-debug --save-dev
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;
}
// ...
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;
}
debug
: boolean - flag for debug mode- Default:
'true'
- Default:
npm test