postcss-amplify
PostCSS plugin to optimize CSS for Google AMP.
This plugin works by filtering out:
- Media queries for desktop breakpoints
- Non
-webkit-
vendor prefixes - Specific class block names or other prefixes (for use with BEM or other namespacing methodologies)
!important
flags-amp
classes ori-amp
tags
{}
Usage
Check your project for existing PostCSS config: postcss.config.js
in the project root, "postcss"
section in package.json
or postcss
in bundle config.
If you already use PostCSS, add the plugin to plugins list:
module.exports = { plugins: [+ require('postcss-amplify')(options), require('autoprefixer') ]}
If you do not use PostCSS, add it according to official docs and set this plugin in settings.
Options
options.maxBreakpoint (string) To allow for larger mobile styling, media queries below this breakpoint will be preserved.
options.excludedBlocks (string or array) List of class blocks or prefixes to exclude. Do not include the .
.