babel-plugin-extract-string

1.2.0 • Public • Published

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)

Package Sidebar

Install

npm i babel-plugin-extract-string

Weekly Downloads

1

Version

1.2.0

License

MIT

Last publish

Collaborators

  • cssobj