JSPM

wechat-mini-loader

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q33715F
  • 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.js文件的方式编写小程序(将模板、JS、样式写在一个文件中),这种组织方式比较方便,而且一目了然

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

安装

npm install mini-wechat-loader

webpack.config

module.exports = {
  module: {
    rules: [
      {
        test: /\.mina$/,
        loader: 'wechat-mina-loader'
      }
    ]
  }
}

使用方式

最简单的姿势

require('./pages/index/index.mina')

在 app.js 中项目中引入之后会在根目录的 dist 文件夹下生成三份文件分别为

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

关于语法

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