Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

cmify

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cmify

A node-first approach to CSS Modules

  • 1.6.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-83.33%
Maintainers
1
Weekly downloads
 
Created
Source

cmify (aka node-css-modules)

Build Status

A node-first approach to CSS Modules, so you can use CSS Modules on the server without any extra tools.

Example

var cmify = require('cmify')
var styles = cmify.load('./styles.css')

console.log('Generated classnames:', styles)
console.log('Generated CSS:', cmify.getAllCss())

For a complete example take a look at cmify-example

Building for the browser

With browserify:

npm install -D browserify

browserify -p cmify/plugin src/index.js

With hot module reloading:

npm install -D watchify browserify-hmr

watchify -p browserify-hmr -p cmify/plugin src/index.js -o dist/index.js

Saving the generated CSS to a file:

npm install -D browserify

browserify -p [cmify/plugin -o lib/out.css] src/index.js

Note: -o is an alias for --outfile.

How to add postcss plugins

You can add postcss plugins before or after the core CSS Modules transformation:

const cmify = require('cmify')

cmify.init({
  cssBefore: [ /* array of postcss plugins */ ],
  cssAfter:  [ /* array of postcss plugins */ ],
  generateScopedName: (originalFn) => function (exportedName, filename) => String
})

cmify.init is optional. It should only be called once, and needs to be called before the first cmify.load.

Thanks

to the CSS Modules team and contributors

License

MIT

Keywords

FAQs

Package last updated on 05 Oct 2016

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc