提交 8b16b319 编写于 作者: J Jason Park

gulp prod

上级 eaae81e9
'use strict'; 'use strict';
import path from 'path'; import path from "path";
import gulp from 'gulp'; import gulp from "gulp";
import uglify from 'gulp-uglify'; import uglify from "gulp-uglify";
import cleanCSS from 'gulp-clean-css'; import cleanCSS from "gulp-clean-css";
import autoprefixer from 'gulp-autoprefixer'; import autoprefixer from "gulp-autoprefixer";
import concat from 'gulp-concat'; import concat from "gulp-concat";
import header from 'gulp-header'; import header from "gulp-header";
import babel from 'gulp-babel'; import gutil from "gulp-util";
import gutil from 'gulp-util'; import sourcemaps from "gulp-sourcemaps";
import sourcemaps from 'gulp-sourcemaps'; import connect from "gulp-connect";
import connect from 'gulp-connect'; import browserify from "browserify";
import browserify from 'browserify'; import babelify from "babelify";
import babelify from 'babelify'; import source from "vinyl-source-stream";
import source from 'vinyl-source-stream'; import buffer from "vinyl-buffer";
import buffer from 'vinyl-buffer'; import pkg from "./package.json";
import pkg from './package.json';
const appName = 'algorithm_visualizer'; const appName = 'algorithm_visualizer';
const appEntryPoint = './js/index.js'; const appEntryPoint = './js/index.js';
...@@ -80,9 +79,9 @@ gulp.task('minify-js', () => { ...@@ -80,9 +79,9 @@ gulp.task('minify-js', () => {
gutil.log('\n\nBuild JS Paths: \n', jsDir, '\n\n'); gutil.log('\n\nBuild JS Paths: \n', jsDir, '\n\n');
return browserify({ return browserify({
entries: './js/index.js', entries: './js/index.js',
debug: true debug: true
}) })
.transform('babelify', { .transform('babelify', {
presets: ['es2015'] presets: ['es2015']
}) })
...@@ -105,9 +104,9 @@ gulp.task('build-js', () => { ...@@ -105,9 +104,9 @@ gulp.task('build-js', () => {
gutil.log('\n\nBuild JS Paths: \n', jsDir, '\n\n'); gutil.log('\n\nBuild JS Paths: \n', jsDir, '\n\n');
return browserify({ return browserify({
entries: './js/index.js', entries: './js/index.js',
debug: true debug: true
}) })
.transform('babelify', { .transform('babelify', {
presets: ['es2015'] presets: ['es2015']
}) })
...@@ -131,7 +130,7 @@ gulp.task('build', ['compile-css', 'compile-js']); ...@@ -131,7 +130,7 @@ gulp.task('build', ['compile-css', 'compile-js']);
// Server // Server
gulp.task('connect', function() { gulp.task('connect', function () {
connect.server({ connect.server({
port: process.env.PORT || 8080, port: process.env.PORT || 8080,
...@@ -141,11 +140,20 @@ gulp.task('connect', function() { ...@@ -141,11 +140,20 @@ gulp.task('connect', function() {
// Watch // Watch
gulp.task('watch', ['build'], function() { gulp.task('watch', ['build'], function () {
gulp.watch(jsDir, ['compile-js']); gulp.watch(jsDir, ['compile-js']);
gulp.watch(cssDir, ['compile-css']); gulp.watch(cssDir, ['compile-css']);
}); });
// Heroku Production
gulp.task('prod', ['build'], function () {
connect.server({
port: process.env.PORT || 8080,
livereload: false
});
});
// Default // Default
gulp.task('default', ['connect', 'watch']); gulp.task('default', ['connect', 'watch']);
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
"description": "Algorithm Visualizer", "description": "Algorithm Visualizer",
"main": "index.js", "main": "index.js",
"scripts": { "scripts": {
"start": "gulp", "start": "gulp prod",
"test": "echo \"Error: no test specified\" && exit 1" "test": "echo \"Error: no test specified\" && exit 1"
}, },
"repository": { "repository": {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册