1.2.0 • Published 7 years ago

babel-plugin-extract-string v1.2.0

Weekly downloads
2
License
MIT
Repository
github
Last release
7 years ago

babel-plugin-extract-string

Babel plugin to extract string from js source file then save into array

API

  • Node
import { transform } from 'babel-core'
import extractString from 'babel-plugin-extract-string'

const result = transform(sourceCode, {
    plugins: [ [extractString, {name: 'abc'}] ]
})

console.log(result.code)
  • .babelrc
{
  "presets": ["es2015"],
  "plugins": [ ["extract-string", {"name": "abc"}] ]
}

OPTIONS

{...} have below keys

  • name

Array name to place into code, replace the position of each string, as arrayName[index]

  • minLength

Don't touch string length less than minLength

  • file

Output file to store extracted string (as json array)