Skip to content

Commit

Permalink
configurable port for app and development
Browse files Browse the repository at this point in the history
application port: PORT
port for development: PORT_DEV
PORT_DEV will take effect when run gulp browser-sync.
Meaning that PORT_DEV will take effect when run `npm run dev` too.
  • Loading branch information
makemek committed Feb 8, 2017
1 parent eaeedbd commit dec2db2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions .env.template
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
"SESSION_SECRET": "DEFAULT",
"LOGGER_SILENT": "false",
"LOGGER_LEVEL": "info",
"PORT": 5000,
"PORT_DEV": 3000,

"KANCOLLE_SERVER_MASTER": "http://203.104.209.7",
"KANCOLLE_SERVER_1" : "http://203.104.209.71",
Expand Down
14 changes: 8 additions & 6 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
'use strict'

const appPort = process.env.PORT
const devPort = process.env.PORT_DEV
const css = 'src/views/*.css'
const htmlTemplate = 'src/views/**/*.hbs'

const gulp = require('gulp')
const postcss = require('gulp-postcss')
const autoprefixer = require('autoprefixer')
Expand All @@ -8,10 +13,6 @@ const rename = require('gulp-rename')
const bs = require('browser-sync').create()
const nodemon = require('gulp-nodemon')

const devPort = 8080
const css = 'src/views/*.css'
const htmlTemplate = 'src/views/**/*.hbs'

gulp.task('build', ['build:css'])

gulp.task('build:css', () => {
Expand All @@ -28,7 +29,7 @@ gulp.task('nodemon', done => {
return nodemon({
script: 'bin/www',
ignore: ['gulpfile.js', 'node_modules/', 'src/views/'],
env: {PORT: devPort}
env: {PORT: appPort}
})
.on('start', () => {
if(!start) {
Expand All @@ -40,7 +41,8 @@ gulp.task('nodemon', done => {

gulp.task('browser-sync', ['nodemon'], () => {
bs.init({
proxy: `localhost:${devPort}`,
proxy: `localhost:${appPort}`,
port: devPort,
open: false
})

Expand Down

0 comments on commit dec2db2

Please sign in to comment.