This repository has been archived by the owner on May 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
coolie.config.js
91 lines (80 loc) · 2.24 KB
/
coolie.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/**
* ======================================================
* coolie-cli 配置文件 `coolie.config.js`
* 使用 `coolie init -c` 生成 `coolie.config.js` 文件模板
* 当前配置文件所在的目录为构建的根目录
*
* @link https://coolie.ydr.me/guide/coolie.config.js/
* @author ydr.me
* @version 2.2.4
* @create 2017-10-27 13:31:52
* =======================================================
*/
'use strict'
const path = require('path')
const config = require('./config')
const coolieView = require('./plugins/coolie-view')
const coolieBabel = require('./plugins/coolie-babel')
module.exports = function (coolie) {
// coolie 配置
coolie.config({
// 目标配置
dest: {
// 目标目录,相对于当前文件
dirname: config.build.assetsRoot,
// 目标根域
host: config.build.assetsPublicPath,
// 版本号长度
versionLength: 32
},
// 是否在构建之前清空目标目录
clean: true,
// html 构建
html: {
// html 文件,相对于当前文件
src: 'views/**/*.html',
// html 压缩配置
minify: true
},
// js 构建
js: {
// 入口模块,相对于当前文件
main: 'views/**/*.js',
// coolie-config.js 路径,相对于当前文件
'coolie-config.js': './coolie-config.js',
// js 文件保存目录,相对于 dest.dirname
dest: path.join(config.build.assetsSubDirectory, 'js/'),
// 分块配置
chunk: [],
// js 压缩配置
minify: {
global_defs: {
DEBUG: false
}
}
},
// css 构建
css: {
// css 文件保存目录,相对于 dest.dirname
dest: path.join(config.build.assetsSubDirectory, 'css/'),
// css 压缩配置
minify: true
},
// 资源
resource: {
// 资源保存目录,相对于 dest.dirname
dest: path.join(config.build.assetsSubDirectory, 'res/'),
// 是否压缩
minify: true
},
// 原样复制文件,相对于当前文件
copy: [
'./favicon.ico',
'./robots.txt'
]
})
// 添加 babel 中间件
coolie.use(coolieBabel())
// 使用模板编译 HTML
if (config.dev.view) coolie.use(coolieView(config.dev.view))
}