-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
58 lines (45 loc) · 1.56 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
// Gulpfile.js
// Require the needed packages
var gulp = require('gulp'),
stylus = require('gulp-stylus'),
sourcemaps = require('gulp-sourcemaps'),
autoprefixer = require('gulp-autoprefixer'),
concat = require('gulp-concat'),
stripDebug = require('gulp-strip-debug'),
uglify = require('gulp-uglify'),
plumber = require('gulp-plumber');
// Get and render all .styl files recursively
gulp.task('stylesheets', function () {
gulp.src('./styl/application.styl')
.pipe(plumber())
.pipe(sourcemaps.init())
.pipe(stylus())
.pipe(autoprefixer("last 2 versions", "> 5%", "ie 10", "ie 9"))
.pipe(concat('styles.css'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./public/css'));
});
gulp.task('javascripts', function() {
// guulp
// build minified javascripts, jquery first
gulp.src([
// './js-source/lib/jquery-1.11.3.js',
// './js-source/lib/*.js',
'./js-source/*.js'
])
.pipe(sourcemaps.init())
.pipe(concat('application.min.js'))
.pipe(sourcemaps.write())
.pipe(gulp.dest('./public/js'));
});
// Watch Files For Changes
gulp.task('watch', function() {
// gulp.watch('js/*.js', ['lint', 'scripts']);
gulp.watch('./styl/*.styl', ['stylesheets']);
gulp.watch('./styl/*/*.styl', ['stylesheets']);
gulp.watch(['./js-source/*.js', './js-source/lib/*.js'], ['javascripts']);
// gulp.watch(, ['javascripts']);
});
gulp.task('build', ['stylesheets', 'javascripts']);
// This 'default' task will run if yo usimply type 'gulp' into the terminal
gulp.task('default', ['stylesheets', 'javascripts', 'watch']);