Socket
Socket
Sign inDemoInstall

patternplate-transform-cssmodules-symbols

Package Overview
Dependencies
4
Maintainers
2
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    patternplate-transform-cssmodules-symbols

patternplate transform creating css modules


Version published
Weekly downloads
5
Maintainers
2
Install size
9.63 MB
Created
Weekly downloads
 

Changelog

Source

0.2.1 (2016-04-04)

Bug Fixes

  • generation: update file.mtime if an imported style file is fresher (919c645)

<a name="0.2.0"></a>

Bug Fixes

  • detection: configure stylePattern basename filters correctly (b8c9b99)
  • detection: throw if no style file is found (0d95ea6)
  • errors: log import identifier when no style file is found (cadf14c)

Features

  • use concerns (demo/index) to resolve patterns (57a2f9b)

<a name="0.1.1"></a>

Readme

Source

patternplate-transform-cssmodules-symbols

patternplate transform to enable usage of css modules

:warning: This transform is intended to be used in conjunction with patternplate-transform-cssmodules and depends on it being configured properly for styles files to import.

See the Configuration section for details.

Installation

npm install --save patternplate-transform-cssmodules-symbols patternplate-transform-cssmodules

Configuration

// file: configuration/patternplate-server/patterns.js
module.exports = {
  formats: {
    css: {
      name: 'Style',
      transforms: ['cssmodules']
    },
    jsx: {
      name: 'Markup',
      transforms: ['cssmodules-symbols', 'react', 'react-to-markup']
    }
  }
};
// file: configuration/patternplate-server/transforms.js
module.exports = {
  'cssmodules-symbols': {
    inFormat: 'jsx',
    outFormat: 'jsx'
  },
  cssmodules: {
    inFormat: 'css',
    outFormat: 'css'
  }
};

Usage

Sources

// atoms/button/index.jsx
import styles from 'style://Pattern';
import cx from 'classnames';

const className = cx(styles.default, {
  [styles.disabled]: this.props.disabled
});

<button className={className}>
  {this.props.children}
</button>
/* atoms/button/index.css */
.default {
  padding: 5px 10px;
  background: blue;
  color: white;
}
.disabled {
  background: grey;
}

Transformed

// <Button>Lorem Ipsum dolor si amnet</Button>
<button class="_button_4erg9ut2">
  Lorem Ipsum dolor si amnet
</button>

// <Button>Lorem Ipsum dolor si amnet</Button>
<button class="_button_4erg9ut2 _button_iert9832">
  Lorem Ipsum dolor si amnet
</button>
/* atoms/button/index.css */
._button_4erg9ut2 {
  padding: 5px 10px;
  background: blue;
  color: white;
}
._button_iert9832 {
  background: grey;
}

Keywords

FAQs

Last updated on 04 Apr 2016

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