Skip to content

bigxigua/easywebpack-cli

 
 

Repository files navigation

easywebpack-cli

NPM version build status Test coverage David deps npm download

Webpack Building Command Line And Boilerplate Init Tool for easywebpack.

Global Command easywebpack or easy, 目前支持如下四种构建:

其中 VueReact 支持客户端运行模式构建和服务端模式构建, Weex 支持Native模式和Web模式构建.

一.特性

二. 安装

$ npm i easywebpack-cli -g

三. 运行

easywebapck -h

Usage: easywebpack [command] [options]

Options:

-V, --version          output the version number
-f, --filename [path]  webpack config file name, default webpack.config.js
-w, --watch            webpack watch and hot-update
-m, --hash             webpack md5 hash js/css/image
-c, --compress         webpack compress js/css/image
-b, --build [option]   w(watch), m(hash) , c(compress), ex: wm/wc/mc/wmc
-h, --help             output usage information

Commands:

init [options]         init webpack config or boilerplate for Vue/React/Weex
install                npm install
print  [env] [options] print webpack config, support print by env or config node key
build  [env]           webpack building
server [env]           webpack building and start server
clean  [env]           clean webpack cache
open   [dir]           open webpack cache dir

四. 命令介绍

4.1 配置模板和Boilerplate初始化

  • easywebpack init

step one:

nstep one

step two:

step two

4.2 编译举例

  • easywebpack build

  • easywebpack build -f build/webpack.config.js

  • easywebpack build -c

  • easywebpack build dev

  • easywebpack build test

  • easywebpack build prod

  • easywebpack build -b wmc

默认读取项目根目录下的 webpack.config.js 配置

4.3 编译和启动服务举例

  • easywebpack server

  • easywebpack server -f build/webpack.config.js

  • easywebpack server dev

  • easywebpack server test

  • easywebpack server prod

  • easywebpack server -b wmc

默认读取项目根目录下的 webpack.config.js 配置

4.4 打印配置

easywebpack print -h

Usage: print [env] [options]

print webpack config, support print by env or config node key

Options:

-n, --node [key]  print webpack config info by config node key, example: [module/module.rules/plugins] and so on
-h, --help        output usage information
  • easywebpack print -n module

  • easywebpack print dev -n entry

  • easywebpack print test -n module.rules

  • easywebpack print prod -n module.rules[0]

  • easywebpack print -n plugins

  • easywebpack print -n plugins[0]

  • easywebpack print -n output

  • easywebpack print -n resolve

4.5 清除缓存

easy clean

4.6 打开缓存目录

easy open

默认读取项目根目录下的 webpack.config.js 配置

五. License

MIT

说明: npm 模板下载参考 egg-init 脚手架实现.

About

easywebpack Command Tool, Support init Vue/Reac/Weex webpack Config And Boilerplate

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%