Created
July 24, 2018 08:24
-
-
Save HugoDF/e7eff831ad672882cb329f8d67775c63 to your computer and use it in GitHub Desktop.
Revisions
-
HugoDF created this gist
Jul 24, 2018 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,88 @@ { "name": "express-pug-scss-starter", "version": "1.0.0", "description": "Express server rendered app with Pug and SCSS", "main": "server.js", "config": { "app": "server.js", "scss": "./src/scss", "css": "./dist/css", "img_src": "./src/img/", "img_dist": "./dist/img/", "img_extensions": "svg,png,jpg,jpeg" }, "scripts": { "start": "node $npm_package_config_app", "dev": "concurrently --kill-others --names \"SERVE,SCSS,IMAGES\" -c \"bgRed.bold,black.bgYellow.dim,bgMagenta.bold\" \"npm run serve:dev\" \"npm run watch:css\" \"npm run watch:img\"", "build": "concurrently --names \"CSS,IMAGES\" -c \"bgRed.bold,black.bgYellow.dim\" \"npm run build:css\" \"npm run build:img\"", "build:css": "node-sass $npm_package_config_scss -o $npm_package_config_css", "build:img": "mkdir -p $npm_package_config_img_dist && cp -r $npm_package_config_img_src $npm_package_config_img_dist", "watch:css": "npm run build:css && node-sass --watch --recursive $npm_package_config_scss -o $npm_package_config_css --source-map true", "watch:img": "nodemon -w $npm_package_config_img_src --exec npm run build:img --ext $npm_package_config_img_extensions", "serve:dev": "nodemon $npm_package_config_app", "coverage": "npm t -- --runInBand --coverage", "lint": "semistandard './src/**/*.js' --verbose | snazzy", "lint:fix": "semistandard --fix --verbose | snazzy", "format": "prettier-semi --write '{,!(node_modules)/**/}*.js'", "format:single": "prettier-semi --write" }, "author": "Kite", "dependencies": { "axios": "^0.18.0", "compression": "^1.7.3", "express": "^4.16.3", "helmet": "^3.12.1", "morgan": "^1.9.0", "pug": "^2.0.3", "winston": "^3.0.0" }, "devDependencies": { "browser-sync": "^2.24.6", "concurrently": "^3.6.0", "jest": "^23.3.0", "node-sass": "^4.9.2", "nodemon": "^1.17.4", "prettier-semi-cli": "^1.0.0", "snazzy": "^7.0.0", "supertest": "^3.1.0" }, "engines": { "node": "10", "npm": "6" }, "semistandard": { "globals": [ "describe", "test", "jest", "beforeEach", "afterEach", "beforeAll", "afterAll", "expect", "fail" ] }, "jest": { "testRegex": ".*spec.js$", "moduleFileExtensions": [ "js" ], "collectCoverageFrom": [ "**/*.js", "!config/**", "!src/app.js", "!server.js", "!**/node_modules/**", "!**/*/index.js" ] }, "nodemonConfig": { "ignore": [ "*.spec.js" ], "watch": [ "./src" ] } } This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,27 @@ const express = require('express'); const app = require('./src/app'); app.use('/public', express.static('dist')); const PORT = process.env.PORT || 3000; app.listen(PORT, () => { console.log('Server listening on port', PORT); if (process.env.NODE_ENV !== 'production') { console.log('Proxying on port', PORT + 1); require('browser-sync')({ files: ['src/**/*.{pug}', 'dist/**/*'], online: false, open: false, port: PORT + 1, proxy: 'localhost:' + PORT, ui: false }); } }); process.on('SIGINT', () => { // This is to avoid EADDRINUSE issues with Nodemon console.log('Exiting'); process.exit(); });