@@ -34,10 +34,11 @@ const custom_assets = (process.env.CUSTOM_ASSETS||'').split(/ +/).filter(Boolean
3434const p = fn => ( req , res , next ) => fn ( req , res ) . catch ( next )
3535
3636app . get ( '/' , ( req , res ) => res . render ( rpath ( 'client/index.pug' ) ) )
37+ app . get ( process . env . BASE_HREF + 'app.js' , browserify ( rpath ( 'client/src/run-browser.js' ) ) )
3738app . get ( '/app.js' , browserify ( rpath ( 'client/src/run-browser.js' ) ) )
3839
3940// Merges the main stylesheet from www/style.css with the custom css files
40- app . get ( '/ style.css', p ( async ( req , res ) =>
41+ app . get ( process . env . BASE_HREF + ' style.css', p ( async ( req , res ) =>
4142 res . type ( 'css' ) . send ( await prepCss ( ) ) ) )
4243
4344const prepCss = async _ =>
@@ -58,13 +59,13 @@ custom_assets.forEach(pattern => {
5859 , stat = fs . statSync ( path )
5960
6061 stat . isDirectory ( )
61- ? app . use ( '/' + name , express . static ( path ) )
62- : app . get ( '/' + name , ( req , res ) => res . sendFile ( path ) )
62+ ? app . use ( process . env . BASE_HREF + name , express . static ( path ) )
63+ : app . get ( process . env . BASE_HREF + name , ( req , res ) => res . sendFile ( path ) )
6364 } )
6465} )
6566
6667// And finally the default fallback assets from www/
67- app . use ( '/' , express . static ( rpath ( 'www' ) ) )
68+ app . use ( ` ${ process . env . BASE_HREF } ` , express . static ( rpath ( 'www' ) ) )
6869
6970app . use ( ( req , res ) => res . render ( rpath ( 'client/index.pug' ) ) )
7071
0 commit comments