Add JS wrapper to CSS to support Serverless target

Resolves #281
This commit is contained in:
Iain Collins
2020-06-21 15:01:07 +01:00
parent 6eeed21872
commit 52f2dd5c32
4 changed files with 32 additions and 6 deletions

10
src/css/index.js Normal file
View File

@@ -0,0 +1,10 @@
// To support serverless targets (which don't work if you try to read in things
// like CSS files at run time) this file is replaced in production builds with
// a function that returns compiled CSS (embedded as a string in the function).
import fs from 'fs'
import path from 'path'
const pathToCss = path.join(__dirname, '/index.css')
const css = fs.readFileSync(pathToCss, 'utf8')
export default () => css