-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
70 lines (62 loc) · 1.93 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
const
gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
minifycss = require('gulp-minify-css'),
rename = require('gulp-rename'),
browserSync = require('browser-sync').create(),
concat = require('gulp-concat'),
uglify = require('gulp-uglifyjs'),
babel = require('gulp-babel');
gulp.task('browser-sync', ['scripts'], function() {
browserSync.init({
server: {
baseDir: "./app"
},
notify: false,
browser: "firefox"
});
});
gulp.task('scripts', function() {
return gulp.src([
'./bower/angular/angular.min.js',
'./bower/angular-ui-router/release/angular-ui-router.min.js',
'./bower/jquery/dist/jquery.min.js',
'./bower/angular-translate/angular-translate.min.js',
'./js/**/*.js'
])
/*.pipe(babel({
presets: ['es2015']
}))*/
.pipe(concat('lib.js'))
//.pipe(uglify()) //Minify libs.js
.pipe(gulp.dest('./app/lib/'));
});
gulp.task('styles', function () {
return gulp.src('sass/*.sass')
.pipe(sass({
includePaths: require('node-bourbon').includePaths
}).on('error', sass.logError))
.pipe(rename({suffix: '.min', prefix : ''}))
.pipe(autoprefixer({browsers: ['last 15 versions'], cascade: false}))
.pipe(minifycss())
.pipe(gulp.dest('app/styles'))
.pipe(browserSync.stream());
});
gulp.task('watch', function () {
gulp.watch('sass/**/*.sass', ['styles']);
gulp.watch('js/**/*.js', ['scripts']);
gulp.watch('js/**/*.js').on("change", browserSync.reload);
gulp.watch('app/**/*.html').on('change', browserSync.reload);
});
gulp.task('default', ['browser-sync', 'watch']);
// ES6 -> ES2015
gulp.task('transpile', function() {
gulp.src(['./js/**/*.js', '!./js/original'])
.pipe(gulp.dest('./js/original'));
return gulp.src(['./js/**/*.js', '!./js/original'])
.pipe(babel({
presets: ['es2015']
}))
.pipe(gulp.dest('./js'));
});