0.1.0 • Published 8 years ago
comment-toggle-loader v0.1.0
comment-toggle-loader
Webpack loader for toggling javascript comment, avoiding hard code debug snippets in source code files.
Installation
npm i comment-toggle-loader -D
Usage
{
test: /\.js$/i,
loader: 'comment-toggle-loader',
query: {
enable: process.env.NODE_ENV === 'development'
}
}
Webpack will replace
/* @debug@
console.info('Your debug info here');
*/
with
console.info('Your debug info here');
It will remove comment with query.match
in development
environment and do nothing in production
environment.
Meanwhile, the other comments not contain query.match
will not be toggled.
Config
query.match
: Comments withquery.match
will be toggled. Default is'@[\\w-]+@'
, which is a part of regular expression.query.enable
: Whether or not to enable comment toggling.
0.1.0
8 years ago