File tree Expand file tree Collapse file tree 5 files changed +25
-10
lines changed Expand file tree Collapse file tree 5 files changed +25
-10
lines changed Original file line number Diff line number Diff line change @@ -82,7 +82,7 @@ Or with regular HTML:
8282
8383``` js
8484new LoadingScreenPlugin ({
85- logo: ' <svg xmlns>...</svg >'
85+ logo: ' <div>my logo</div >'
8686})
8787```
8888
@@ -122,6 +122,11 @@ Progress hooks report details.
122122
123123Reference: https://webpack.js.org/plugins/progress-plugin/
124124
125+ ### showPercent
126+
127+ - Type: ` boolean `
128+ - Default: ` true `
129+
125130## Credits
126131
127132- [ ** nuxt/loading-screen** ] ( https://github.com/nuxt/loading-screen )
Original file line number Diff line number Diff line change 2323 <div class =" progress_bar_container" >
2424 <div class =" progress_bar" :style =" { width: `${states[bundle].progress}%`, backgroundColor: theme[bundle] }" />
2525 </div >
26- <h4 >{{ states[bundle].status }}</h4 >
26+ <div class =" progress_status_container" >
27+ <h4 >{{ states[bundle].status }}</h4 >
28+ <h4 v-if =" theme.showPercent" >{{ states[bundle].progress }}%</h4 >
29+ </div >
2730 </div >
2831 </transition-group >
2932 </div >
Original file line number Diff line number Diff line change 7676 width : 10px ;
7777 transition : width 0.4s ;
7878}
79+
80+ .progress_status_container {
81+ display : flex;
82+ justify-content : space-between;
83+ }
Original file line number Diff line number Diff line change @@ -12,7 +12,9 @@ class LoadingUI {
1212 this . baseURL = opts . baseURL
1313
1414 this . logo = opts . logo
15- this . theme = opts . theme
15+ this . theme = Object . assign ( opts . theme , {
16+ showPercent : opts . showPercent
17+ } )
1618
1719 this . serveIndex = this . serveIndex . bind ( this )
1820 this . serveWS = this . serveWS . bind ( this )
Original file line number Diff line number Diff line change @@ -5,26 +5,30 @@ const { ProgressPlugin: Plugin } = require('webpack')
55module . exports = class ProgressPlugin extends Plugin {
66 constructor ( opts = { } ) {
77 super ( )
8+ this . env = opts . env || process . env . NODE_ENV || 'development'
9+
10+ this . isProd = this . env === 'production'
11+
812 this . opts = Object . assign (
913 {
1014 baseURL : '/' ,
1115 logo : 'https://webpack.js.org/assets/icon-square-big.svg' ,
1216 host : 'localhost' ,
1317 port : process . env . port || 4000 ,
1418 callback : ( ) => {
19+ if ( this . isProd ) return
1520 console . log ( `[loading screen]: http://localhost:${ this . opts . port } ` )
1621 } ,
1722 theme : {
1823 client : '#8ed5fb' ,
1924 server : '#1b78bf' ,
2025 modern : '#2f495e'
21- }
26+ } ,
27+ showPercent : true
2228 } ,
2329 opts
2430 )
2531
26- this . env = opts . env || process . env . NODE_ENV
27-
2832 this . connections = new Set ( )
2933
3034 this . handler = ( per , message , ...details ) => {
@@ -47,10 +51,6 @@ module.exports = class ProgressPlugin extends Plugin {
4751 }
4852
4953 async init ( ) {
50- if ( this . env !== 'development' ) {
51- return
52- }
53-
5454 const LoadingUI = require ( './loading' )
5555 this . loading = new LoadingUI ( this . opts )
5656
You can’t perform that action at this time.
0 commit comments