# Remax

返回:小程序 | github | 官网

npx create-remax-app my-app
$ cd my-app && npm install

npm run dev
# npm run dev <platform>
npm run dev wechat
# wechat ali toutiao web


# ts开发
$ npx create-remax-app my-app-ts -t
$ cd my-app-ts && npm i

$ yarn create remax-app my-app-ts -t
$ cd my-app-ts && yarn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15

TIP

ali, wechat, toutiao, web

  • 编译微信小程序后报错找不到 app.json
    • 修改project.config.json指定小程序的根目录即可(即 app.json 所在目录)
  "miniprogramRoot": "wechat/",
  "description": "项目配置文件,详见文档:https://developers.weixin.qq.com/miniprogram/dev/devtools/projectconfig.html",
  "srcMiniprogramRoot": "wechat/"
1
2
3

# 使用插件

@remax/plugin-less 为例:

npm install @remax/plugin-less --save
1

在 remax.config.js 中配置:

const less = require("@remax/plugin-less");
module.exports = {
  plugins: [
    less({
      lessOptions: {
        globalVars: {
          "primary-color": '"#4569d4"',
        },
      },
    }),
  ],
};
1
2
3
4
5
6
7
8
9
10
11
12