babel-plugin-inline-hash-id

0.1.0 • Public • Published

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

Package Sidebar

Install

npm i babel-plugin-inline-hash-id

Weekly Downloads

3

Version

0.1.0

License

MIT

Unpacked Size

6.29 kB

Total Files

15

Last publish

Collaborators

  • guntur