Skip to content

Latest commit

 

History

History
62 lines (53 loc) · 1.4 KB

File metadata and controls

62 lines (53 loc) · 1.4 KB

postcss-parse-atrule-events

Postcss plugin for auto generating code

Dependency Status devDependency Status

Installation

$ npm install postcss-parse-atrule-events --save

Usage

Via Node API

let result = require('postcss-parse-atrule-events').parse('code');

Example

Input:

    @on load {
        @fetch my/async/styles1.css;
        @fetch my/async/styles1.css;
    }
    .my-critical-path-selector {
        width: 100px;
        height: 100px;
    }

Output:

let output = [
     {
         attachOn: "load",
         imports: [
             "my/async/styles1.css",
             "my/async/styles1.css"
         ],
         styles: "",
         type: "on",
     },
     {
         attachOn: "immediately",
         imports: [],
         styles: ".my-critical-path-selector { width: 100px; height: 100px; }",
         type: "default",
     },
 ];

Tests

git clone https://github.com/SerkanSipahi/app-decorators.git
cd app-decorators/packages/postcss-parse-atrule-events
npm run test