-
Notifications
You must be signed in to change notification settings - Fork 74
/
gulpfile.js
83 lines (66 loc) · 2.12 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
'use strict';
// load plugins
var gulp = require('gulp');
var sass = require('gulp-sass');
var minifycss = require('gulp-minify-css');
var imagemin = require('gulp-imagemin');
var concat = require('gulp-concat');
var del = require('del');
var notify = require('gulp-notify');
var uglify = require('gulp-uglify');
var includes = require('./src/includes.json');
// styles
gulp.task('styles', function() {
var tmp = gulp.src('src/styles/app.scss')
.pipe(sass().on('error', sass.logError));
// unminified
tmp.pipe(concat('rpgui.css'))
.pipe(gulp.dest('dist/'));
// minified
return tmp.pipe(concat('rpgui.min.css'))
.pipe(minifycss())
.pipe(gulp.dest('dist/'))
.pipe(notify({ message: 'styles task complete' }));
});
// scripts
gulp.task('scripts', function() {
var tmp = gulp.src(includes);
// unminified
tmp.pipe(concat('rpgui.js'))
.pipe(gulp.dest('dist/'))
.pipe(notify({ message: 'scripts task complete' }));
// minified
return tmp.pipe(concat('rpgui.min.js'))
.pipe(uglify())
.pipe(gulp.dest('dist/'))
.pipe(notify({ message: 'scripts task complete' }));
});
// images
gulp.task('images', function() {
//return gulp.src('src/images/**/*')
// .pipe(imagemin({ optimizationLevel: 3, progressive: true, interlaced: true }))
// .pipe(gulp.dest('dist/images'))
// .pipe(notify({ message: 'images task complete' }));
});
// clean
gulp.task('clean', function() {
return del(['dist/css', 'dist/js', 'dist/images']);
});
// default task
gulp.task('default', ['watch'], function() {
// gulp.start('styles', 'scripts', 'images');
});
// watch
gulp.task('watch', ['clean', 'styles', 'scripts', 'images'], function() {
// Watch .scss files
gulp.watch('src/styles/**/*.scss', ['styles']);
// Watch .js files
gulp.watch('src/scripts/**/*.js', ['scripts']);
// Watch image files
gulp.watch('src/images/**/*', ['images']);
// Watch any files in dist/, reload on change
gulp.watch(['dist/**']);
});
// dist
gulp.task('dist', ['clean', 'styles', 'scripts', 'images'], function() {
});