-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
69 lines (62 loc) · 1.78 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
const gulp = require('gulp');
const sass = require('gulp-sass');
const autoprefixer = require('gulp-autoprefixer');
const sourcemaps = require('gulp-sourcemaps');
const concat = require('gulp-concat');
const csso = require('gulp-csso');
const babel = require('gulp-babel');
const rename = require('gulp-rename');
const uglify = require('gulp-uglify');
const paths = {
js: [
'src/js/app.js',
'src/js/controllers/*.js',
'src/js/services/*.js'
]
}
// Default Task
gulp.task('default', ['sass', 'js', 'views', 'images']);
gulp.task('sass', function() {
return gulp.src('src/scss/**/*.scss')
.pipe(sass())
.pipe(sourcemaps.init())
.pipe(concat('main.css'))
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(csso())
.pipe(rename({
extname: '.min.css'
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('build/css'));
});
gulp.task('js', function() {
return gulp.src(paths.js)
.pipe(concat('main.js'))
.pipe(babel({
presets: ['@babel/env'],
plugins: ["angularjs-annotate"]
}))
.pipe(uglify())
.pipe(rename({
extname: '.min.js'
}))
.pipe(gulp.dest('build/js/'));
})
gulp.task('views', function() {
return gulp.src('src/views/**/*.html')
.pipe(gulp.dest('build/views'));
});
gulp.task('images', function() {
return gulp.src('src/images/**/*.*')
.pipe(gulp.dest('build/images'));
});
// Watch Files For Changes
gulp.task('watch', function() {
gulp.watch('src/scss/**/*.scss', ['sass']);
gulp.watch('src/views/**/*.html', ['views']);
gulp.watch('src/images/**/*.*', ['images']);
gulp.watch(paths.js, ['js']);
});