Skip to content

Commit

Permalink
Pre-transpile stylus, move to devDependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
shesek committed Mar 6, 2018
1 parent c8c6202 commit 06ce58c
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 16 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
.env
dist
static/style.css
35 changes: 26 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "",
"scripts": {
"start": "./start.sh",
"dist": "babel -d dist src",
"dist": "babel -d dist src && stylus static/style.styl",
"prepublishOnly": "npm run dist"
},
"bin": "dist/cli.js",
Expand All @@ -20,7 +20,6 @@
"dependencies": {
"babel-polyfill": "^6.26.0",
"bootswatch": "^4.0.0-beta.2",
"commander": "^2.12.2",
"cookie-parser": "^1.4.3",
"csurf": "^1.9.0",
"currency-formatter": "^1.3.1",
Expand All @@ -40,14 +39,14 @@
"pretty-bytes": "^4.0.2",
"pug": "^2.0.0-rc.4",
"qruri": "0.0.3",
"read-chunk": "^2.1.0",
"stylus": "^0.54.5"
"read-chunk": "^2.1.0"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-plugin-syntax-object-rest-spread": "^6.13.0",
"babel-plugin-transform-object-rest-spread": "^6.26.0",
"babel-preset-env": "^1.6.1",
"babel-register": "^6.26.0"
"babel-register": "^6.26.0",
"stylus": "^0.54.5"
}
}
5 changes: 4 additions & 1 deletion src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,13 @@ app.use(require('body-parser').urlencoded({ extended: false }))
app.use(require('csurf')({ cookie: true }))

// Static assets
app.use('/_assets', require('stylus').middleware({ src: conf.static_dir, serve: true }))
if (app.settings.env == 'development' && require.resolve('stylus'))
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) => {
const file = await files.load(req.body.file)
Expand Down
1 change: 0 additions & 1 deletion static/.gitignore

This file was deleted.

0 comments on commit 06ce58c

Please sign in to comment.