https://github.com/futurist/babel-plugin-extract-string
Babel plugin to extract string from js source file then save into array
https://github.com/futurist/babel-plugin-extract-string
babel-plugin compress-string extract-string
Last synced: about 2 months ago
JSON representation
Babel plugin to extract string from js source file then save into array
- Host: GitHub
- URL: https://github.com/futurist/babel-plugin-extract-string
- Owner: futurist
- License: mit
- Created: 2017-03-13T12:43:16.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-16T10:45:11.000Z (about 8 years ago)
- Last Synced: 2025-03-17T07:02:45.730Z (2 months ago)
- Topics: babel-plugin, compress-string, extract-string
- Language: JavaScript
- Size: 11.7 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# babel-plugin-extract-string
Babel plugin to extract string from js source file then save into array## API
- `Node`
```javascript
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`
```json
{
"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**)