Skip to content
轻量级小程序框架,旨在解决不支持scss等痛点
JavaScript
Branch: 1.0.0
Clone or download
fusheng
fusheng docs:up
Latest commit 0fb5c7f May 16, 2018
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
demo feat:up demo May 4, 2018
lib feat:add api promisify Feb 28, 2018
.gitignore feat:up readme & demo May 2, 2018
cover.jpg feat:enhancement Feb 25, 2018
jane.js feat:add api promisify Feb 28, 2018
package.json feat:change doc Mar 2, 2018
readme.md docs:up May 16, 2018

readme.md

jane

cover

  • scss、less、async、await、api的promise化处理

安装

lib install

npm install --save @linhun/jane

功能

  • .scss、.styl、.less -> .wxss
  • es6 -> es5, support babel plugins #sourcemap
  • async、await
  • support build watch

快速开始

cli install

sudo npm install -g @linhun/jane-cli

init project

jane new project

build project

jane build // on production
jane build -w // watch build on develop

config file

module.exports = {
  dest:'build',
  tpl:{
    page:'' // must be directory
  },
  css: {
    ext:'.scss',
    compiler: require('jane-sass'),
    // ref:https://github.com/sass/node-sass
    config:{}
  },
  js: {
    ext:'.js',
    compiler: 'babel',
    // https://babeljs.io/docs/usage/api/
    config: {
      presets:['env'],
      plugins: ["transform-node-env-inline"]
    }
  },

  ignore:['node_modules','dist','.DB_store','.DS_Store']
}

插件

环境判断

  • 安装
  npm i --save babel-plugin-transform-node-env-inline
  • 引入
js: {
    ext:'.js',
    compiler: 'babel',
    // https://babeljs.io/docs/usage/api/
    config: {
      presets:['env'],
      plugins: ["transform-node-env-inline"]
    }
  }
  • 使用
  NODE_ENV=production jane build
  • 代码中
  console.log(process.env.NODE_ENV)

更多用法

jane --help

  Usage: jane [options] [command]
  
  Options:

    -v, --version  显示版本号
    -w, --watch    监视目录改动
    -h, --help     output usage information


  Commands:

    clean          清空build目录
    build          编译项目
    new <project>  新建项目
    page <page>    新建页面
    upgrade        更新

Todo

  • image minify

谁在用

  • 掌上链家
  • 贝壳
  • 贝壳估价
  • 链家新房

License

MIT

You can’t perform that action at this time.