包详细信息

postcss-amplify

laurenashpole35MIT0.0.2

PostCSS plugin to optimize CSS for Google AMP

postcss, css, postcss-plugin, amp

自述文件

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 or i-amp tags
body {
  font-size: 14px;
}

@media (min-width: 768px) {
  body {
    font-size: 16px;
  }
}

.heading {
  color: #000 !important;
}

.menu {
  -webkit-transition: all 0.5s ease;
  -moz-transition: all 0.5s ease;
  -ms-transition: all 0.5s ease;
  -o-transition: all 0.5s ease;
  transition: all 0.5s ease;
}

.-amp-image {
  width: 300px;
}
body {
  font-size: 14px;
}

.heading {
  color: #000;
}

.menu {
  -webkit-transition: all 0.5s ease;
  transition: all 0.5s ease;
}

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 ..

更新日志

Change Log

All notable changes to this project will be documented in this file. See Conventional Commits for commit guidelines.

0.0.2 (2020-01-24)

Note: Version bump only for package postcss-amplify

0.0.1 (2020-01-13)

Note: Version bump only for package postcss-amplify