Socket
Book a DemoInstallSign in
Socket

babel-plugin-cmz-names

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

babel-plugin-cmz-names

Babel plugin to give [`cmz`](https://github.com/joshwnj/cmz) nice readable classnames.

latest
Source
npmnpm
Version
1.5.0
Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

babel-plugin-cmz-names

Babel plugin to give cmz nice readable classnames.

To activate, first install in your project:

npm install --save-dev babel-plugin-cmz-names

And then this to your .babelrc:

{
  "plugins": ["cmz-names"]
}

Customising the name

By default, classnames are generated using the path to the module, and the line number. This makes it easy to find exactly where a style was declared.

For example, if you see src_components_MyComponent-15 you will look on line 15 of src/components/MyComponent.js.

Sometimes you want a bit more control over this naming, like if you're building a style library for distribution.

An easy way to do this is by configuring the plugin with 1 or more string-replacements. In .babelrc it looks like this:

{
  "plugins": ["cmz-names", {
    replace: [
      ["src_components", "MyLib"]
    ]
  }]
}

This means the classname from before will be rendered as MyLib_MyComponent-15.

FAQs

Package last updated on 19 Oct 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts