babel-plugin-prefix-console-log
v1.1.0
Published
This ia a plugin that will append to the console.log a prefix specified in the settings
Downloads
3
Maintainers
Readme
babel-plugin-prefix-console-log
This is a library that allows you to append to any amount of arguments in the console log. a Prefix. The default prefix is 'Bonify Rocks' where as you can specify in the .babelrc file the option prefix which will append the prefix that you would like to you console.log.
For additional information on babel plugins read the following
Read babel plugin handbook -> https://github.com/thejameskyle/babel-handbook/blob/master/translations/en/plugin-handbook.md
Try http://astexplorer.net/#/Pcw9baefXI for a visual understanding.
Special thank you to https://github.com/supreetpal/babel-plugin-boilerplate for the boilerplate work done. Thank you.
Example
In
console.log('Hello');
Out
console.log('Bonify RocksHello');
Installation
$ npm install babel-plugin-prefix-console-log
Usage
Via .babelrc
(Recommended)
.babelrc
{
"plugins": ["prefix-console-log", {
"prefix": "Whatever you want "
}]
}
Via CLI
$ babel --plugins prefix-console-log script.js
Via Node API
require("@babel/core").transform("code", {
plugins: ["prefix-console-log"]
});