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

css-modules-component-template

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

css-modules-component-template

Styled UI component template with CSS-Modules

  • 1.0.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
6
increased by500%
Maintainers
1
Weekly downloads
 
Created
Source

css-modules-component-template

Gitter

Circle CI Dependency Status devDependency Status

Styled UI component template with CSS-Modules

Usage

npm install --save css-modules-component-template

Example app

import Component from 'css-modules-component-template';

// Add global ".component" class name to Component without overriding original one
Component.css.component = `${Component.css.component} component`;

const App = React.createClass({
  render() {
    return (
      <div>
        <pre>
          Component classNames: {JSON.stringify(Component.css, null, 2)}
        </pre>
        <Component />
      </div>
    );
  }
});

NOTE: you will need to copy css-modules-component-template/lib/Component.css to your assets folder if you do not use any sort of build process for css.

Basic browserify build scripts in package.json:

  "scripts: {
    "prebuild": "cp -f node_modules/css-modules-component-template/lib/Component.css ./public/Component.css",
    "build": "browserify index.js -t babelify --outfile ./public/bundle.js"
  }

If you are using css build process you can simply require Component.css in your module:

import Component from 'css-modules-component-template';

import 'css-modules-component-template/lib/Component.css';
import './styles.css';

Component.css.component = `${Component.css.component} component`;

const App = React.createClass({
  // ...
});

Demo app

Github:

https://github.com/nkbt/css-modules-component-template-test

Published to Github Pages pre-built example:

[http://nkbt.github.io/css-modules-component-template-test] (http://nkbt.github.io/css-modules-component-template-test)

Rendered lib Component

With original css-modules class and app-specific override

styled component

Keywords

FAQs

Package last updated on 22 Oct 2015

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