1.0.2 • Published 1 year ago

xml-conditional-compile v1.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

babel-plugin-conditional-compile

README-zh-CN

Overview

A pure function lib as core for HTML conditional compilation.

Install

To install the plugin, run the following command:

npm install --save-dev xml-conditional-compile

Or, if you're using Yarn:

yarn add --dev xml-conditional-compile

Usage

Configuration

This library serves as the core library and provides APIs in pure functional form. It can be used in extensions or plugins of various building tools to help complete conditional compilation.

import xmlConditionalCompile from 'xml-conditional-compile'

const newHtmlStr = xmlConditionalCompile(originalHtmlStr)

Coding with Conditional Compilation

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

<body>
<!-- ifdef targetPlat=WX|TT -->
    <h1>如果targetPlat命中WX|TT这里就会保留</h1>
    <h1>gnidaeH1</h1>
<!-- endif -->
    <p>My first paragraph.</p>
<!-- ifndef targetPlat=WX|TT -->
    <h1>如果targetPlat命中WX|TT这里就会删除</h1>
    <h1>gnidaeH2</h1>
<!-- endif -->
</body>

License

LICENSE

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago