https://github.com/qzruncode/sww-cli
No need to reconfigure webpack, works out of the box
https://github.com/qzruncode/sww-cli
Last synced: over 1 year ago
JSON representation
No need to reconfigure webpack, works out of the box
- Host: GitHub
- URL: https://github.com/qzruncode/sww-cli
- Owner: qzruncode
- Created: 2021-12-26T08:41:55.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2022-02-10T07:46:25.000Z (over 4 years ago)
- Last Synced: 2025-02-13T23:47:34.060Z (over 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 829 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
[](https://www.npmjs.com/package/sww-cli)
[](https://www.npmjs.com/package/sww-cli)
## sww-cli
1. 基于webpack开发的前端脚手架cli工具,不需要配置webpack,下载此插件安装即可。
2. 支持react、typescript、less等
3. 能够将前端的文件打包成合适的大小,避免文件臃肿。
4. 此插件是本人在开发[cacheweb-webpack-plugin](https://www.npmjs.com/package/cacheweb-webpack-plugin)时配套开发的脚手架工具。
5. 支持使用模板,配套模板[sww-template](https://www.npmjs.com/package/sww-template)提供开箱即用的配置环境,内置[cacheweb-webpack-plugin](https://www.npmjs.com/package/cacheweb-webpack-plugin),集成开发所需的各种配置
## 支持的命令
```
sww --help
sww run --help 查看run命令的参数
-m 指定编译模式 Dev | Pro
-url 指定 PUBLIC_URL
-c 开启运行时检查
-r 开启px转换成rem
-H 开启HTTPS
-h 设置开发环境的HOST
sww init sww-template 初始化模板
```
## sww-cli的使用
```js
"scripts": {
"start": "sww run -m Dev -h cache.service-worker.com -H -url /",
"build": "sww run -m Pro -url /",
}
```
## 模板的安装
```
git init
npm install sww-cli
npx sww-cli init sww-template
npm install
npm start 开发
npm build 生产
```
## 插件
```js
// 在项目根目录新建webpack.plugins.js,在文件中写入
const cachewebWebpackPlugin = require('cacheweb-webpack-plugin');
module.exports = [
new cachewebWebpackPlugin({
chacheName: 'SW',
expirationHour: 72,
maxNum: 0,
noCacheFileList: ['index.html', 'register.js'],
cacheFirstList: ['cacheFirstTest', 'acacheFirstTes', 'bcacheFirstTes'],
permanentCacheList: ['test'],
}),
];
```
## 使用注意
```
安装此插件的项目需要配置如下配置文件
.browserslistrc
.env
.eslintrc.js
tsconfig.json
```