Giter Club home page Giter Club logo

easywebpack-cli's Introduction

easywebpack-cli

NPM version build status David deps npm download

easywebpack cli 命令行工具 for easywebpack, 支持常用骨架初始化, Webpack 编译功能

一.特性

二. 安装

$ npm i easywebpack-cli -g

按照成功后, 可以在命令行使用全局命令 easywebpack or easy

三. 运行

easy -h

Usage: easy [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
kill   [port]          kill port, such as 7001 or 7001,9000,9001

四. 命令介绍

4.1 配置模板和Boilerplate初始化

  • easy init

step one:

step one

step two:

step two

4.2 编译举例

  • easy build

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

  • easy build dev

  • easy build test

  • easy build prod

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

4.3 编译和启动服务举例

  • easy server

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

  • easy server dev

  • easy server test

  • easy server prod

  • easy server -b wmc

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

4.4 动态安装

easywebpack 解决方案只内置了必须的几个常用 loader 和 plugin, 其他 loader (比如 less, stylus) 和 plugin (imagemini) 都是需要项目自己根据需要安装。 如果你自己搭建项目,遇到依赖缺失错误,除了手动 npm install 安装以外, 可以使用 easy install 命令,安装所有缺失的依赖,默认是 npm 方式

easy install

通过 mode 参数指定 cnpm 方式安装依赖(前提是你全局安装了cnpm)

easy install --mode cnpm

4.5 清除缓存

easy clean

4.6 打开缓存目录

easy open

4.7 杀进程(3.6.0)

easy kill 7001
easy kill 7001,9000,9001

4.8 构建大小分析(3.6.0)

通过 -s 参数启动构建大小分析工具, 支持 analyzer(webpack-bundle-analyzer) 和 stats(stats-webpack-plugin) , 默认用 analyzer插件。

easy build -s 

使用 stats(stats-webpack-plugin) 构建大小分析工具

easy build -s stats

4.9 打印配置

easy print -h

Usage: print [env] [options]

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

Options:

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

  • easy print dev -k entry

  • easy print test -k module.rules

  • easy print prod -k module.rules[0]

  • easy print -k plugins

  • easy print -k plugins[0]

  • easy print -k output

  • easy print -k resolve

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

五. License

MIT

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

easywebpack-cli's People

Contributors

hubcarl avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.