File tree Expand file tree Collapse file tree 4 files changed +10
-4
lines changed Expand file tree Collapse file tree 4 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -16,4 +16,6 @@ support mock for html base on html-webpack-plugin
1616## test
1717可支持之定义模板匹配规则
1818## data
19- 渲染模板的模拟数据
19+ 渲染模板的模拟数据
20+ ## template
21+ 模板名称(可选),要和html-webpack-plugin一致,主要是解决多页的情况
Original file line number Diff line number Diff line change @@ -41,7 +41,9 @@ var MockHtml = function () {
4141
4242 compiler . plugin ( 'compilation' , function ( compilation ) {
4343 compilation . plugin ( 'html-webpack-plugin-before-html-processing' , function ( data , cb ) {
44- data . html = _this . mock ( data . html , _this . options . data ) ;
44+ if ( ! _this . options . template || _this . options . template === data . outputName ) {
45+ data . html = _this . mock ( data . html , _this . options . data ) ;
46+ }
4547 cb ( null , data ) ;
4648 } ) ;
4749 } ) ;
Original file line number Diff line number Diff line change 11{
22 "name" : " mock-html-webpack-plugin" ,
3- "version" : " 0.2.0 " ,
3+ "version" : " 0.2.1 " ,
44 "description" : " support mock for html when develop" ,
55 "main" : " dist/index.js" ,
66 "files" : [
Original file line number Diff line number Diff line change @@ -21,7 +21,9 @@ class MockHtml {
2121 apply ( compiler ) {
2222 compiler . plugin ( 'compilation' , compilation => {
2323 compilation . plugin ( 'html-webpack-plugin-before-html-processing' , ( data , cb ) => {
24- data . html = this . mock ( data . html , this . options . data )
24+ if ( ! this . options . template || this . options . template === data . outputName ) {
25+ data . html = this . mock ( data . html , this . options . data )
26+ }
2527 cb ( null , data )
2628 } )
2729 } )
You can’t perform that action at this time.
0 commit comments