babel-plugin-pretty-console

1.1.2 • Public • Published

pretty console logo.

babel-plugin-pretty-console

Use hooks for fast console.log

Install

npm install babel-plugin-pretty-console -D

Usage

Configure PrettyConsole to your .babelrc file.

{
  "plugins": ["pretty-console"]
}

Examples

// #
function add(a, b) {
  return a + b;
}

// equals:

function add(a, b) {
  console.log('add:a', a)
  console.log('add:b', b)
  return a + b;
}
// #warn
let a = add(1, 2)

// equals:

let a = add(1, 2)
console.warn(a)
// #error TestFunction
let add = (a, b) => a + b

// equals:

let add = (a, b) => {
  console.error('TestFunction:a', a)
  console.error('TestFunction:b', b)
  return a + b
}

Plugin options

  • token Set hook token used in comments
  • open Set plugin enabled status
  • printFileName Set print filename to console.log

Comments hook options

// token[consoleType] [hookName]

// ex:
// #warn TestFunction

Readme

Keywords

Package Sidebar

Install

npm i babel-plugin-pretty-console

Weekly Downloads

2

Version

1.1.2

License

ISC

Unpacked Size

7.65 kB

Total Files

8

Last publish

Collaborators

  • yangxin___