Dynamically locate bootswatch directory, mount to /_theme

The previous implementation using symlinks does not work on npm
(which doesn't allow symlinks)
This commit is contained in:
Nadav Ivgi 2018-03-06 07:02:16 +02:00
parent 1237c24bfe
commit abf9282155
3 changed files with 3 additions and 2 deletions

View File

@ -1,3 +1,4 @@
import path from 'path'
import { pwrap, pick, fcurrency, fmsat, pngPixel } from './lib/util'
// Setup
@ -40,6 +41,7 @@ app.use(require('csurf')({ cookie: true }))
// Static assets
app.use('/_assets', require('stylus').middleware({ src: conf.static_dir, serve: true }))
app.use('/_assets', require('express').static(conf.static_dir))
app.use('/_themes', require('express').static(path.resolve(require.resolve('bootswatch/package'), '..', 'dist')))
// Create invoice
app.post('/_invoice', pwrap(async (req, res) => {

View File

@ -1 +0,0 @@
../node_modules/bootswatch/dist

View File

@ -10,7 +10,7 @@ block head
title= title
link(rel='stylesheet', href='_assets/bootswatch/'+conf.theme+'/bootstrap.min.css')
link(rel='stylesheet', href='_themes/'+conf.theme+'/bootstrap.min.css')
link(rel='stylesheet', href='_assets/style.css')
noscript: style .yesscript{display:none}