miniprogram-compiler
compiler
Last updated 6 years ago by wechat-miniprogram .
Original npm · Tarball · package.json
$ cnpm install miniprogram-compiler 
SYNC missed versions from official npm registry.

miniprogram-compiler

介绍

这是 wcc、wcsc 官方编译器的 node 封装版,用于编译 wxml、wxss 文件。

快速上手

安装

npm install miniprogram-compiler

使用

编译 wxml:

const {wxmlToJs} = require('miniprogram-compiler')

const compilerString = wxmlToJs(miniprogramProjectRoot)
const compiler = new Function('global', compilerString)
const $gwx = compiler({})

// 假设项目里有 wxml/index.wxml 文件
const generateFunc = $gwx('wxml/index.wxml')
const compilerRes = generateFunc({
    // 数据
})

console.log(compilerRes)

编译 wxss:

const {wxssToJs} = require('miniprogram-compiler')

const compilerString = wxssToJs(miniprogramProjectRoot)
const compiler = new Function('global', compilerString)
const $gwx = compiler({})

// 假设项目里有 wxss/index.wxss 文件
const generateFunc = $gwx('wxss/index.wxss')
generateFunc('前缀') // 会插入到 style 中

Current Tags

  • 0.2.2                                ...           latest (3 years ago)

14 Versions

  • 0.2.2                                ...           3 years ago
  • 0.2.1                                ...           4 years ago
  • 0.2.0                                ...           4 years ago
  • 0.1.3                                ...           5 years ago
  • 0.1.2                                ...           6 years ago
  • 0.1.1                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
  • 0.0.7                                ...           7 years ago
  • 0.0.6                                ...           7 years ago
  • 0.0.5                                ...           7 years ago
  • 0.0.4                                ...           7 years ago
  • 0.0.3                                ...           7 years ago
  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           7 years ago
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (1)
Dependents (1)

Copyright 2013 - present © cnpmjs.org | Home |