-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGulpfile.js
85 lines (74 loc) · 2.51 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
var gulp = require('gulp'),
compass = require('gulp-compass'),
autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'),
browserSync = require('browser-sync'),
reload = browserSync.reload,
path = require('path'),
nodemon = require('gulp-nodemon');
var paths = {
sass: {
src: 'src/styles/sass/*.sass',
dir: 'src/styles/sass',
dest: 'public/css'
},
js: {
src: 'src/js/*.js',
dest: 'public/js'
}
};
gulp.task('default', ['styles', 'scripts'], function () {
console.log('Hi Here is gulp default');
});
gulp.task('styles', function () {
return gulp.src(paths.sass.src)
.pipe(compass({
css: paths.sass.dest,
sass: paths.sass.dir
}))
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 7', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(gulp.dest(paths.sass.dest));
// uncomment the following lines if minified css is need
// and make sure have gulp-minify-css installed
// .pipe(rename({ suffix: '.min' }))
// .pipe(minifycss())
// .pipe(gulp.dest(path.js.dest));
});
gulp.task('scripts', function () {
return gulp.src(paths.js.src)
.pipe(concat('main.js'))
.pipe(gulp.dest(paths.js.dest))
// uncomment the following lines if minified js is needed
// and make sure have gulp-uglify installed
// .pipe(rename({ suffix: '.min' }))
// .pipe(uglify())
// .pipe(gulp.dest(paths.js.dest));
});
gulp.task('nodemon', function (cb) {
return nodemon({
script: 'app.js',
ignore: [
'./public/components/**', // bower components
'./node_modules/**',
]
}).on('start', function () {
cb();
});
});
gulp.task('serve', ['default', 'nodemon'], function() {
// listen on 7000, which is a proxy of express server running on 3000
browserSync({
proxy: "http://localhost:3000",
port: 7000,
});
// watch .sass files
gulp.watch(paths.sass.src, ['styles']);
// watch .js files
gulp.watch(paths.js.src, ['scripts']);
// reload when a template file, the compiled css, or the js file changes
gulp.watch([
'views/**/*.tpl',
path.join(paths.sass.dest, '*.css'),
path.join(paths.js.dest, '*.js')])
.on('change', reload);
});