0.0.2 • Published 7 months ago

cpml v0.0.2

Weekly downloads
-
License
-
Repository
-
Last release
7 months ago

cpml

cpml可以帮助开发者快速实现copy功能。

安装

通过 npm:

$ npm install cpml

基本用法

import { copyFile, html, p } from 'cpml'

/** 输出结果路径 */
const OutPutDir = p('./output')
/** 复制来源路径 */
const BasePath = p('./recourse')

let needDir2 = false

copyFile(
    OutPutDir,
    html`<dir name="文件夹名称">
      <dir name="子文件夹1名称">
        <!-- 子文件夹文件 -->
        <file name="128x128.png" copy="${BasePath}/128x128.png" />
        <file name="144x144.png" copy="${BasePath}/144x144.png" />
      </dir>
      
      <!-- 当if为false或'false'时,将会在复制时被忽略 -->
      <dir name="子文件夹2名称" if="${needDir2}">
        <file name="192x192.png" copy="${BasePath}/192x192.png" />
        <!-- template标签作为空标签,主要用于条件判断 -->
        <template if="${needDir2}">
          <file name="192x192.png" copy="${BasePath}/192x192.png" />
        </template>
      </dir>
    </dir>`
  )
0.0.2

7 months ago

0.0.1

7 months ago