JSPM

  • Created
  • Published
  • Downloads 240
  • Score
    100M100P100Q85335F
  • License MIT

Use modular-css via postcss

Package Exports

  • @modular-css/postcss
  • @modular-css/postcss/postcss.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@modular-css/postcss) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@modular-css/postcss NPM Version NPM License NPM Downloads

PostCSS plugin to use modular-css within a PostCSS processor instance.

Install

> npm i @modular-css/postcss postcss

Usage

@modular-css/postcss provides a PostCSS plugin that can be used like any other. It will output a message with a type of modular-css-exports containing all the exported class compositions.

API

const postcss = require("postcss");
const processor = postcss([
    require("@modular-css/postcss")({
        json : "./path/to/output.json"
    })
]);

const result = await processor.process("<css>")

// result.css
// result.map
// result.messages.find((msg) => msg.type === "modular-css-exports")
// etc

Config

> postcss --config postcss.json input.css
{
    "output" : "out.css",
    
    "@modular-css/postcss": {
        "json" : "./path/to/output.json"
    }
}

CLI

> postcss --use modular-css/postcss input.css

Options

json

Write the class composition data to this location on disk.

Shared Options

All other options are passed to the underlying Processor instance, see Options.