Skip to content

BlueStoneQ/postcss-plugin-conditional-compile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

babel-plugin-conditional-compile

README-zh-CN

Overview

A Babel plugin for conditional compilation.

Install

To install the plugin, run the following command:

npm install --save-dev postcss-plugin-conditional-compile

Or, if you're using Yarn:

yarn add --dev postcss-plugin-conditional-compile

Usage

Configuration

Add the plugin to your postcss configuration file.

postcss.config.js

module.exports = {  
  plugins: [
    ...
    require('./babel-plugin-conditional-compile')({  
      targetPlat: 'WX'
    }) 
  ]  
}

Coding with Conditional Compilation

In your css files, you can use special comments to mark code blocks for conditional compilation.

@media screen and (min-width: 480px) {
  body {
      background-color: lightgreen;
  }
}

/* ifdef targetPlat=WX|TT */
.wx {
  border: 1px solid black;
}

ul li {
padding: 5px;
}
/* endif */

/* ifndef targetPlat=WX|TT */
.tt1 {
  border: 1px solid black;
}

ul li {
padding: 5px;
}
/* endif */

.a {}

License

LICENSE

About

A postcss plugin for conditional compilation

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published