postcss-stylus-parser
TypeScript icon, indicating that this package has built-in type declarations

2.0.0 • Public • Published

NPM Dependencies DevDependencies Tests

postcss-stylus-parser

PostCSS parser plugin to compile Stylus to CSS.

Uses original Stylus parser to parse *.styl files.

Install

npm install --save-dev postcss-stylus-parser

Usage

import postcss from 'postcss';
import stylusParser from 'postcss-stylus-parser';
 
const stylusContent = `
my-color = red
 
.imported
    color my-color
`;
 
postcss( plugins )
    .process(
        stylusContent,
        {
            from: 'test.styl',
            parser: stylusParser(),
        }
    )
    .then(
        ( result ) =>
        {
            console.log( result.css );
            /*
            .imported {
              color: #f00;
            }
            */
        }
    );

With Stylus options:

postcss( plugins )
    .process(
        stylusContent,
        {
            from: 'test.styl',
            parser: stylusParser(
                {
                    'resolve url': true,
                    'functions': {
                        url: stylus.resolver( {nocheck: true} ),
                    },
                },
            ),
        }
    )
    .then(
        ( result ) =>
        {
            console.log( result.css );
        }
    );

Change Log

View changelog.

License

MIT.

Package Sidebar

Install

npm i postcss-stylus-parser

Weekly Downloads

4

Version

2.0.0

License

MIT

Unpacked Size

8.21 kB

Total Files

10

Last publish

Collaborators

  • avol