0.1.0 • Published 5 years ago

postcss-amp-process v0.1.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

PostCSS Amp Process Build Status

PostCSS plugin Process css for AMP for twig. Create css for AMP to using with twig template.

Replace strings in value.

/* before */
.thumb {
  background-image: url(../images/thumb.png);
}

/* after */
.thumb {
  background-image: url({{ your_static_path|raw }}/images/thumb.png);
}

/* or */

.thumb {
  background-image: url(http://sample.com/images/thumb.png);
}

Add space to minified css

To avoid an error with '{#' (twig start comment) or '%}' (just for sure)

/* before */
@media (max-width:991px){#header{height:100px}#footer{height:50%}}

/* after */
@media (max-width:991px){ #header{height:100px}#footer{height:50% }}

Usage

Add PostCSS Amp Process to your build tool:

npm install postcss-amp-process --save-dev

PostCSS

Load PostCSS Amp Process as a PostCSS plugin:

postcss([
  require('postcss-amp-process')({
    /* options */
  }),
]);

Options

You can define your own array strings replace

require('postcss-unmq')({
  replace: [['find', 'replace'], [/\.\.\//g, '{{ your_static_path|raw }}/']],
});