PostCSS Preset Env,

the Babel for CSS

Developer Advocate 🥑
at
@SchibstedSpain

 

Co-Founder & UI Engineers

at @sublime_codes


PerfReviewer at @PerfReviews_

 

Joan León

.Hello {

}

#Javascript

#CSS

#PostCSS

#Animation

#SVG

#WebPerformance

PostCSS Preset Env lets you convert modern CSS into something most browsers can understand, determining the polyfills you need based on your targeted browsers or runtime environments, using cssdb.

postcss-preset-env

Use tomorrow’s CSS today.

Features
Try It Now
Support
GitHub

Usage

npm install postcss-preset-env --save-dev

Node.js | PostCSS CLI | Webpack | Create React App | Gulp | Grunt

Usage

npm install postcss-cli --save-dev

PostCSS CLI

const postcssPresetEnv = require('postcss-preset-env');

module.exports = {
  plugins: [
    postcssPresetEnv(/* pluginOptions */)
  ]
}

postcss.config.js

Komenco

  "devDependencies": {
    ...
    "postcss-cli": "^6.1.1",
    "postcss-devtools": "^1.1.1",
    "postcss-import": "^12.0.1",
    "postcss-normalize": "^7.0.1",
    "postcss-preset-env": "^6.5.0",
    "postcss-reporter": "^6.0.1",
    "...
  }

package.json

Komenco

module.exports = (ctx) => ({
  map: ctx.options.map,
  plugins: {
    'postcss-devtools': ctx.env === 'development' ? {} : false,
    'postcss-import': {},
    'postcss-normalize': { browsers: 'last 2 versions', forceImport: true },
    'postcss-preset-env': { stage: 0 },
    'stylelint': ctx.env === 'development' ? {} : false,
    'postcss-reporter': ctx.env === 'development' ? { clearMessages: true } : false,
    'cssnano': ctx.env === 'production' ? {} : false
  }
})

postcss.config.js

cssdb

cssdb is a comprehensive list of CSS features and their positions in the process of becoming implemented web standards.

cssdb

Stage 0: Aspirational

“This is a crazy idea.”

Stage 1: Experimental

“This idea might not be crazy.”

Stage 2: Allowable

“This idea is not crazy.”

Stage 3: Embraced

“This idea is becoming part of the web.”

Stage 4: Standardized

“This idea is part of the web.”

Rejected

“I had no idea what I was doing.”

cssdb

Stage level

Name & Description

Link to Specification & MDN

Sample code

Browser support

Link to PostCSS plugin

Enjoy CSS

.Thanks {

}