forked from baytelman/FBMonkeys
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
50 lines (42 loc) · 1.45 KB
/
gulpfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
const gulp = require('gulp');
const replace = require('gulp-replace');
var productionUrl = 'https://sleepy-gorge-61610.herokuapp.com';
var webpackDevServerUrl = 'http://localhost:8080';
var devUrl = 'http://localhost:5000';
// Example
// gulp.task('t', function(){
// gulp.src(['./lib/phantomPageLoader.js'], {base: './'})
// .pipe(replace('http://localhost:8080/', '/js/'))
// .pipe(gulp.dest('./'));
// });
gulp.task('production-js-1', function(){
var filenames = [
'./views/index.ejs'
];
filenames.forEach( function (name) {
gulp.src([name], {base: './'})
.pipe(replace( webpackDevServerUrl + '/app.js', '/js/app.js'))
.pipe(gulp.dest('./'));
});
});
gulp.task('dev-js-1', function(){
var filenames = [
'./views/index.ejs'
];
filenames.forEach( function (name) {
gulp.src([name], {base: './'})
.pipe(replace('/js/app.js', webpackDevServerUrl + '/app.js'))
.pipe(gulp.dest('./'));
});
});
gulp.task('production', ['production-js-1'], function () {
console.log('Asset paths ready for production');
})
gulp.task('dev', ['dev-js-1'], function () {
console.log('Asset paths ready for development');
})
gulp.task('default', function() {
// place code for your default task here
console.log("Use 'npm run gulp production' to prepare for deploy.");
console.log("Use 'npm run gulp dev' to prepare for development.");
});