Skip to content

huchenme/unique-name.macro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

unique-name.macro

NPM Version Travis (.org) Babel Macro

This is a babel-macros to generate unique name.

Usage

With babel-macros and this package installed, you can use it like this.

import uniqueName from 'unique-name.macro'

const disabledClass = uniqueName() // or const disabledClass = uniqueName('disabledClass')

The above snippet will be compiled in build time:

import uniqueName from 'unique-classname.macro'

const disabledClass = 'disabledClass-1u6x1nq'

Note

The unique name is based on file path and variable name, it will remain the same as long as you don't move the file or rename the variable.