xml-conditional-compile

1.0.2 • Public • Published

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

Package Sidebar

Install

npm i xml-conditional-compile

Weekly Downloads

0

Version

1.0.2

License

MIT

Unpacked Size

4.2 kB

Total Files

6

Last publish

Collaborators

  • bluestoneq