File tree 2 files changed +23
-19
lines changed
2 files changed +23
-19
lines changed Original file line number Diff line number Diff line change @@ -101,19 +101,21 @@ export const prepare = async (app, config) => {
101
101
staticDirs = [ staticDirs ]
102
102
}
103
103
104
- await Promise . all ( staticDirs . map ( async dir => {
105
- const staticFiles = await fs . getFiles ( dir )
106
-
107
- if ( ! is . empty ( staticFiles ) ) {
108
- const staticPromises = staticFiles . map ( async f => {
109
- const name = f . replace ( dir , '' )
110
- // TODO: use streams here
111
- app . static [ name ] = await fs . readFile ( f )
112
- } )
113
-
114
- await Promise . all ( staticPromises )
115
- }
116
- } ) )
104
+ await Promise . all (
105
+ staticDirs . map ( async dir => {
106
+ const staticFiles = await fs . getFiles ( dir )
107
+
108
+ if ( ! is . empty ( staticFiles ) ) {
109
+ const staticPromises = staticFiles . map ( async f => {
110
+ const name = f . replace ( dir , '' )
111
+ // TODO: use streams here
112
+ app . static [ name ] = await fs . readFile ( f )
113
+ } )
114
+
115
+ await Promise . all ( staticPromises )
116
+ }
117
+ } ) ,
118
+ )
117
119
} catch ( e ) {
118
120
// it's fine if the static dir does not exist,
119
121
// but all other errors will throw.
Original file line number Diff line number Diff line change @@ -22,12 +22,14 @@ export default ({ app, root }) => {
22
22
tags . map ( tag => {
23
23
const urlsTangle = rendered . split ( `${ tag } ="` )
24
24
25
- const urls = urlsTangle . map ( url => {
26
- url = url . split ( '"' ) [ 0 ]
27
- if ( url . startsWith ( '/' ) && ! url . startsWith ( root ) ) {
28
- return [ url , replaceSlashSlash ( `${ root } /${ url } ` ) ]
29
- }
30
- } ) . filter ( a => a )
25
+ const urls = urlsTangle
26
+ . map ( url => {
27
+ url = url . split ( '"' ) [ 0 ]
28
+ if ( url . startsWith ( '/' ) && ! url . startsWith ( root ) ) {
29
+ return [ url , replaceSlashSlash ( `${ root } /${ url } ` ) ]
30
+ }
31
+ } )
32
+ . filter ( a => a )
31
33
32
34
urls . forEach ( ( [ oldUrl , newUrl ] ) => {
33
35
rendered = rendered . replace ( new RegExp ( `${ tag } ="${ oldUrl } "` , 'gim' ) , `${ tag } ="${ newUrl } "` )
You can’t perform that action at this time.
0 commit comments