0.1.0 • Published 6 years ago

babel-plugin-inline-hash-id v0.1.0

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

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