-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
39 lines (34 loc) · 897 Bytes
/
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
const gulp = require('gulp'),
sass = require('gulp-sass'),
sourceMaps = require('gulp-sourcemaps'),
autoPrefixer = require('gulp-autoprefixer'),
cssMin = require('gulp-cssmin')
// js required
uglify = require('gulp-uglify');
//CSS task
gulp.task('css', () => {
return gulp.src(['sass/style.scss'])
.pipe(sourceMaps.init())
.pipe(sass().on('error', sass.logError))
.pipe(cssMin())
.pipe(autoPrefixer())
.pipe(sourceMaps.write())
.pipe(gulp.dest('./css'));
});
// JS task
gulp.task('js', () => {
return gulp.src([
'./node_modules/jquery/dist/jquery.min.js',
'./src/js/admin.js',
'./src/js/magic.js'
])
.pipe(uglify())
.pipe(gulp.dest('./dist/js'))
});
// watch task
gulp.task('watch', () => {
gulp.watch(['./src/sass/*.scss'], ['css']);
gulp.watch(['./src/js/*.js'], ['js']);
});
// Default task
gulp.task('default', ['css', 'js', 'watch']);