babel-plugin-inline-hash-id
v0.1.0
Published
Babel plugin inline function to generate and hash ID
Downloads
9
Maintainers
Readme
babel-plugin-inline-hash-id
Learn AST and create babel plugin.
Generate hash ID by given an input.
Install
$ npm install --save-dev babel-plugin-inline-hash-id
Setup
.babelrc
{
"plugins": [
"inline-hash-id"
]
}
Default Options
{
"plugins": [
["inline-hash-id", {
"fnName": "__hashId",
"algorithm": "sha256",
"digest": "base64",
"maxLength": 12,
"uniqPerFile": true
}]
]
}
Example
Source
React.createElement('div', {
id: __hashId('root')
});
Output
React.createElement('div', {
id: 'BkbudHtGGjOI'
});
See the example
for more details.
License
MIT © Guntur Poetra