diff --git a/gulpfile.js b/gulpfile.js index 9870a0c..1bf47b9 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -7,8 +7,8 @@ const babel = require('gulp-babel'); const paths = { tscripts: { src: ['src/**/*.ts'], dest: 'build' }, jsscripts: { src: ['src/**/*.js'], dest: 'build' }, - staticFiles: { src: ['src/templates/**/*'], dest: 'build/src/templates' }, - staticAssets: { src: ['src/static/**/*'], dest: 'build/src/static' } + staticFiles: { src: ['src/templates/**/*'], dest: 'build/templates' }, + staticAssets: { src: ['src/static/**/*'], dest: 'build/static' } }; function defaultTask(cb) { diff --git a/src/assets.js b/src/assets.js index ff3495e..5d3ae9f 100644 --- a/src/assets.js +++ b/src/assets.js @@ -1,8 +1,10 @@ const HyperExpress = require("hyper-express"); const assetRouter = new HyperExpress.Router(); const LiveDirectory = require("live-directory"); +require('dotenv').config(); -const LiveAssets = new LiveDirectory("./src/static/", { +const assetPath = process.env.DEV_MODE === "true" ? "./src/static/" : "./build/static/"; +const LiveAssets = new LiveDirectory(assetPath, { static: true, filter: { keep: { diff --git a/src/routes.js b/src/routes.js index 7022a7e..e748e47 100644 --- a/src/routes.js +++ b/src/routes.js @@ -2,9 +2,11 @@ const fs = require('node:fs'); const { JSDOM } = require('jsdom'); const herokuRouter = require('./v1/heroku'); const assetRouter = require('./assets'); +require('dotenv').config(); const herokuRouteRoot = "/v1/heroku"; -const homePage = fs.readFileSync('./src/templates/index.html', 'utf8'); +const templatePath = process.env.DEV_MODE === "true" ? "./src/templates/index.html" : "./build/templates/index.html"; +const homePage = fs.readFileSync(templatePath, 'utf8'); const routes = [...assetRouter.routes, { routes: herokuRouter.routes, rootPath: herokuRouteRoot