Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PostCSS

 PostCSS

Matija Marohnić

May 21, 2019
Tweet

More Decks by Matija Marohnić

Other Decks in Programming

Transcript

  1. PostCSS • like Babel, but for CSS • what it

    basically does: 1. “understands” CSS code 2. changes it using plugins
  2. Sass? Less? Stylus? • you can combine them with PostCSS

    • or create a subset of their features using plugins
  3. How PostCSS works • reads CSS file content • converts

    it to an abstract syntax tree (AST) • plugins perform transformations on the AST • new AST is converted back into CSS file content
  4. A good PostCSS plugin • follows a specification (ideally) •

    makes your code better without you being aware of it • isn’t magic, doesn’t invent new syntax
  5. stylelint • like ESLint, but for CSS • used for

    detecting mistakes and discouraging patterns