Socket
Socket
Sign inDemoInstall

babel-plugin-cmz-names

Package Overview
Dependencies
0
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

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.


Version published
Maintainers
1
Install size
3.99 kB
Created

Readme

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

Last updated on 19 Oct 2018

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc