All Projects → ota-meshi → postcss-styl

ota-meshi / postcss-styl

Licence: MIT license
PostCSS parser plugin for converting Stylus syntax to PostCSS AST.

Programming Languages

javascript
184084 projects - #8 most used programming language
Vue
7211 projects
stylus
462 projects
CSS
56736 projects
HTML
75241 projects

Projects that are alternatives of or similar to postcss-styl

Postcss Less
PostCSS Syntax for parsing LESS
Stars: ✭ 93 (+520%)
Mutual labels:  syntax, parse, postcss, postcss-plugin
postcss-styled
PostCSS syntax for parsing styled components
Stars: ✭ 53 (+253.33%)
Mutual labels:  syntax, postcss
es6-template-regex
Regular expression for matching es6 template delimiters in a string.
Stars: ✭ 15 (+0%)
Mutual labels:  syntax, parse
berkeley-parser-analyser
A tool for classifying mistakes in the output of parsers
Stars: ✭ 34 (+126.67%)
Mutual labels:  syntax, parse
Postcss Viewport Height Correction
PostCSS plugin to solve the popular problem when 100vh doesn’t fit the mobile browser screen.
Stars: ✭ 137 (+813.33%)
Mutual labels:  postcss, postcss-plugin
Postcss Rtl
PostCSS plugin for RTL-adaptivity
Stars: ✭ 143 (+853.33%)
Mutual labels:  postcss, postcss-plugin
Naomi
Sublime Text enhanced syntax highlighting for JavaScript ES6/ES7/ES2015/ES2016/ES2017+, Babel, FlowType, React JSX, Styled Components, HTML5, SCSS3, PHP 7, phpDoc, PHPUnit, MQL4. Basic: Git config files.
Stars: ✭ 544 (+3526.67%)
Mutual labels:  syntax, postcss
Rtlcss
Framework for transforming Cascading Style Sheets (CSS) from Left-To-Right (LTR) to Right-To-Left (RTL)
Stars: ✭ 1,363 (+8986.67%)
Mutual labels:  postcss, postcss-plugin
postcss-trash-killer
It is a postcss plugin which wil be remove all unused css
Stars: ✭ 20 (+33.33%)
Mutual labels:  postcss, postcss-plugin
postcss-clearfix
PostCSS plugin that adds a 'fix' argument to the 'clear' property
Stars: ✭ 47 (+213.33%)
Mutual labels:  postcss, postcss-plugin
postcss-input-style
PostCSS plugin that adds new pseudo-elements for easily styling the inner elements of inputs
Stars: ✭ 16 (+6.67%)
Mutual labels:  postcss, postcss-plugin
Postcss Aspect Ratio Mini
A PostCSS plugin to fix an element's dimensions to an aspect ratio
Stars: ✭ 123 (+720%)
Mutual labels:  postcss, postcss-plugin
Container Query
A PostCSS plugin and Javascript runtime combination, which allows you to write container queries in your CSS the same way you would write media queries.
Stars: ✭ 119 (+693.33%)
Mutual labels:  postcss, postcss-plugin
Postcss Spiffing
PostCSS plugin to use British English
Stars: ✭ 158 (+953.33%)
Mutual labels:  postcss, postcss-plugin
Postcss Plugins
The "officially unofficial" consolidated list of PostCSS plugins in a ready-to-use package
Stars: ✭ 107 (+613.33%)
Mutual labels:  postcss, postcss-plugin
postcss-import-url
PostCSS plugin inlines remote files.
Stars: ✭ 47 (+213.33%)
Mutual labels:  postcss, postcss-plugin
Postcss Nested Props
PostCSS plugin to unwrap nested properties.
Stars: ✭ 58 (+286.67%)
Mutual labels:  postcss, postcss-plugin
Postcss Prefix Selector
Prefix all CSS rules with a selector
Stars: ✭ 75 (+400%)
Mutual labels:  postcss, postcss-plugin
postcss-jsx
PostCSS syntax for parsing CSS in JS literals
Stars: ✭ 73 (+386.67%)
Mutual labels:  syntax, postcss
postcss-center
PostCSS plugin to center elements.
Stars: ✭ 44 (+193.33%)
Mutual labels:  postcss, postcss-plugin

This project has moved the repository as an official Stylus project!

It is currently maintained in stylus/postcss-styl!
See https://github.com/stylus/postcss-styl.

postcss-styl

NPM license NPM version NPM downloads Build Status Greenkeeper badge Coverage Status

PostCSS parser plugin for converting Stylus syntax to PostCSS AST.

::: This plugin is still in an experimental state :::

Installation

npm install -D postcss-styl

Usage

Lint Stylus with stylelint

You can use this PostCSS plugin to apply Stylus syntax to stylelint.
You can use it more easily by using it with stylelint-plugin-stylus.

For example, this PostCSS plugin is used as follows:

  1. First, add customSyntax option to stylelint config file.

    e.g. stylelint.config.js

    // Filename: `stylelint.config.js`
    
    module.exports = {
       overrides: [
           {
               files: ["*.styl", "**/*.styl", "*.stylus", "**/*.stylus"],
               customSyntax: "postcss-styl",
           },
       ],
    };
  2. You need to include the stylus in the linting target, as shown in the following example.

    • via CLI

      stylelint ./path/to/input.styl
    • with VSCode extension

      {
        "stylelint.validate": [
           ...,
           // ↓ Add "stylus" language.
           "stylus"
        ]
      }

Stylus Transformations

Also you can use this parser plugin to apply PostCSS transformations directly to the Stylus source code.

For example, Stylus sources can be automatically prefixed using Autoprefixer.

const postcss = require("postcss");
const autoprefixer = require("autoprefixer");
const postcssStyl = require("postcss-styl");

const stylusCode = `
a
  transform scale(0.5)
`;
postcss([autoprefixer])
  .process(stylusCode, {
    syntax: postcssStyl
  })
  .then(result => {
    console.log(result.css);
    // ->
    // a
    //   -webkit-transform scale(0.5);
    //   -moz-transform scale(0.5);
    //   transform scale(0.5)
  });

Contributing

Welcome contributing!

Please use GitHub's Issues/PRs.

Development Tools

  • npm test runs tests and measures coverage.

AST

You can check the AST online.
https://ota-meshi.github.io/postcss-styl/

License

See the LICENSE file for license rights and limitations (MIT).

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].