1.0.0-alpha.2 • Published 6 years ago

babel-plugin-postcss-template-literals v1.0.0-alpha.2

Weekly downloads
932
License
MIT
Repository
github
Last release
6 years ago

babel-plugin-postcss-template-literals

build status dependencies status

Babel plugin for running PostCSS on tagged template literals at build time. Based on babel-plugin-csjs-postcss by Ryan Tsao.

Plugin Options

Option default valueMeaning
tag 'css'A tag that marks literals for processing
replaceTag replacement. Set an empty string if you want to remove the tag
pluginsPostCSS plugins
optionsPostCSS options

Autoprefixer Example

npm i babel-plugin-postcss-template-literals autoprefixer --save-dev

Before:

css`

.foo {
  transform: ${foo};
}

`;

After:

css`

.foo {
  -webkit-transform: ${ foo };
          transform: ${ foo };
}

`;

.babelrc

{
  "plugins": [["postcss-template-literals", {
    "plugins": ["autoprefixer"]
  }]]
}

Advanced Configuration

Before:

cssTag`

.foo {
  transform: ${foo};
}

`;

After:

newCssTag`

.foo {
  -webkit-transform: ${ foo };
          transform: ${ foo };
}

`;

.babelrc

{
  "plugins": [["postcss-template-literals", {
    "tag": "cssTag",
    "replace": "newCssTag",
    "plugins": [["autoprefixer", {"browsers": ["last 2 versions"]}]]
  }]]
}
1.0.0-alpha.2

6 years ago

1.0.0-alpha.1

7 years ago

1.0.0-alpha

7 years ago