kn-cli 1.0.21 → 1.0.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -24,5 +24,9 @@ module.exports = {
24
24
  // cssSplitMode:false,//false=关闭css文件分隔,将css内置到js内
25
25
  // sass:true,//true=开启sass支持,默认仅支持less
26
26
  // indexHtml:false,//false=关闭index.html的注入
27
+ // indexHtml:{
28
+ // template:'index_template.html',
29
+ // output:'../index.html',//将index.html输出到 dist目录外的index.html
30
+ // },
27
31
  // projectSourceFolder:'./',//项目源代码文件夹所在位置,默认是'src'
28
32
  };
@@ -341,11 +341,21 @@ if(indexHtml){
341
341
  if(jsSplitMode===true || jsSplitMode?.runtime !== false){
342
342
  shareJs.splice(0,0,'runtime');
343
343
  }
344
+ let index_template = path.join(dirname, 'index.html');
345
+ let index_template_output= 'index.html';
346
+ if(typeof indexHtml ==='object'){
347
+ if(indexHtml.template){
348
+ index_template = path.join(dirname, indexHtml.template);
349
+ }
350
+ if(indexHtml.output){
351
+ index_template_output = indexHtml.output;
352
+ }
353
+ }
344
354
  plugins.push(
345
355
  new HtmlWebpackPlugin({
346
356
  chunks: ['index',...shareJs],
347
- template: path.join(dirname, 'index.html'),
348
- filename: 'index.html',
357
+ template: index_template,
358
+ filename: index_template_output,
349
359
  inject: true,
350
360
  isProd: process.env.build_env == 'prod',
351
361
  }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kn-cli",
3
- "version": "1.0.21",
3
+ "version": "1.0.22",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/readme.md CHANGED
@@ -46,6 +46,10 @@ module.exports = {
46
46
  cssSplitMode:false,//默认:true,false=关闭css文件分隔,将css内置到js内
47
47
  sass:true,//默认:false,true=开启sass支持,默认仅支持less
48
48
  indexHtml:false,//默认:true,false=关闭index.html的注入
49
+ // indexHtml:{
50
+ // template:'index_template.html',
51
+ // output:'../index.html',//将index.html输出到 dist目录外的index.html
52
+ // },
49
53
  projectSourceFolder:'./',//默认:'./public',项目源代码文件夹所在位置,默认是'src'
50
54
  site_root_path:'',//默认:'',站点根目录,
51
55
  // dist:'dist',// 默认:'dist',编译后文件输出目录
@@ -57,6 +61,9 @@ module.exports = {
57
61
  ```
58
62
 
59
63
  # 更新日志
64
+ * 1.0.22
65
+ 1. cli.config.js 扩展indexHtml的配置项,详细参考注释
66
+
60
67
  * 1.0.21
61
68
  1. cli.config.js内扩展了copyFolder配置项目的功能,现在支持更多配置,详细参考注释
62
69