Skip to content

Commit 31da571

Browse files
committed
gulp prod
1 parent 52cab1c commit 31da571

File tree

2 files changed

+33
-25
lines changed

2 files changed

+33
-25
lines changed

gulpfile.babel.js

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,20 @@
11
'use strict';
22

3-
import path from 'path';
4-
import gulp from 'gulp';
5-
import uglify from 'gulp-uglify';
6-
import cleanCSS from 'gulp-clean-css';
7-
import autoprefixer from 'gulp-autoprefixer';
8-
import concat from 'gulp-concat';
9-
import header from 'gulp-header';
10-
import babel from 'gulp-babel';
11-
import gutil from 'gulp-util';
12-
import sourcemaps from 'gulp-sourcemaps';
13-
import connect from 'gulp-connect';
14-
import browserify from 'browserify';
15-
import babelify from 'babelify';
16-
import source from 'vinyl-source-stream';
17-
import buffer from 'vinyl-buffer';
18-
import pkg from './package.json';
3+
import path from "path";
4+
import gulp from "gulp";
5+
import uglify from "gulp-uglify";
6+
import cleanCSS from "gulp-clean-css";
7+
import autoprefixer from "gulp-autoprefixer";
8+
import concat from "gulp-concat";
9+
import header from "gulp-header";
10+
import gutil from "gulp-util";
11+
import sourcemaps from "gulp-sourcemaps";
12+
import connect from "gulp-connect";
13+
import browserify from "browserify";
14+
import babelify from "babelify";
15+
import source from "vinyl-source-stream";
16+
import buffer from "vinyl-buffer";
17+
import pkg from "./package.json";
1918

2019
const appName = 'algorithm_visualizer';
2120
const appEntryPoint = './js/index.js';
@@ -80,9 +79,9 @@ gulp.task('minify-js', () => {
8079
gutil.log('\n\nBuild JS Paths: \n', jsDir, '\n\n');
8180

8281
return browserify({
83-
entries: './js/index.js',
84-
debug: true
85-
})
82+
entries: './js/index.js',
83+
debug: true
84+
})
8685
.transform('babelify', {
8786
presets: ['es2015']
8887
})
@@ -105,9 +104,9 @@ gulp.task('build-js', () => {
105104
gutil.log('\n\nBuild JS Paths: \n', jsDir, '\n\n');
106105

107106
return browserify({
108-
entries: './js/index.js',
109-
debug: true
110-
})
107+
entries: './js/index.js',
108+
debug: true
109+
})
111110
.transform('babelify', {
112111
presets: ['es2015']
113112
})
@@ -131,7 +130,7 @@ gulp.task('build', ['compile-css', 'compile-js']);
131130

132131
// Server
133132

134-
gulp.task('connect', function() {
133+
gulp.task('connect', function () {
135134

136135
connect.server({
137136
port: process.env.PORT || 8080,
@@ -141,11 +140,20 @@ gulp.task('connect', function() {
141140

142141
// Watch
143142

144-
gulp.task('watch', ['build'], function() {
143+
gulp.task('watch', ['build'], function () {
145144
gulp.watch(jsDir, ['compile-js']);
146145
gulp.watch(cssDir, ['compile-css']);
147146
});
148147

148+
// Heroku Production
149+
150+
gulp.task('prod', ['build'], function () {
151+
connect.server({
152+
port: process.env.PORT || 8080,
153+
livereload: false
154+
});
155+
});
156+
149157
// Default
150158

151159
gulp.task('default', ['connect', 'watch']);

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Algorithm Visualizer",
55
"main": "index.js",
66
"scripts": {
7-
"start": "gulp",
7+
"start": "gulp prod",
88
"test": "echo \"Error: no test specified\" && exit 1"
99
},
1010
"repository": {

0 commit comments

Comments
 (0)