postcss-modules-extract-exports
Extracts ICSS exports that are represented in CSS
Last updated 5 years ago by sullenor .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install postcss-modules-extract-exports 
SYNC missed versions from official npm registry.

postcss-modules-extract-exports

Extracts ICSS exports that are represented in CSS. Saves ICSS exports to the tokens property in the Root node which is generated by PostCSS.

Description

Usually, when you use postcss-modules-scope, you get :export selectors in CSS:

:export {
  continueButton: __buttons_continueButton_djd347adcxz9;
}
.__buttons_continueButton_djd347adcxz9 {
  color: green;
}

which are the part of ICSS format and are used by CSS Modules to export internal data to the consumer.

This module reads those exports, converts them to the plain object and saves to the tokens property at the Root node. Also removes them from the CSS. Example of usage:

const postcss = require('postcss');

const LocalByDefault = require('postcss-modules-local-by-default');
const ExtractImports = require('postcss-modules-extract-imports');
const Scope = require('postcss-modules-scope');

const css = '.continueButton\n{\n  color: green;\n}';
const filepath = '..'; // somefile

const tokens = postcss([LocalByDefault, ExtractImports, Scope])
  .process(css, {from: filepath})
  .root.tokens;
// => {
//  continueButton: '__buttons_continueButton_djd347adcxz9',
// };

Current Tags

  • 1.0.0                                ...           latest (5 years ago)

1 Versions

  • 1.0.0                                ...           5 years ago
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 0
Last Month 0
Dependencies (1)
Dev Dependencies (5)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |