JSPM

wechat-mini-loader

1.0.4
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q33591F
  • License MIT

a mina components loader for webpack

Package Exports

  • wechat-mini-loader

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (wechat-mini-loader) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

一个微信小程序的loader

关于

解析类似vue语法文件 动态生成对应的wxml wxss js json等几个文件

基于wechat-mina-loader基础上做了些更改增加了对json标签的解析和输出配置文件,使用方式跟wechat-mina-loader完全一致。

安装

npm install -D wechat-mini-loader

使用方式 最简单的姿势

在webpack loader 引入mina的loader

  {
    test: /\.mina$/,
    loader: 'wechat-mini-loader',
    options: {
      path: r('../'),
      dist: './dist'
    }
  }	

引入之后会在根目录的 dist 文件夹下生成四份文件分别为

/pages/index/index.wxml
/pages/index/index.wxss
/pages/index/index.json
/pages/index/index.js

关于语法

模版用到了consolidate这一模板引擎来处理vue-template-compiler的parseComponent函数解出来的