-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGulpfile.js
60 lines (51 loc) · 1.67 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
var gulp = require('gulp'),
sass = require('gulp-sass'),
cssnano = require('gulp-cssnano'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
replace = require('gulp-replace'),
del = require('del');
var config = require('./gulp-config.json');
var assets = config.paths.assets;
var source = config.paths.source;
gulp.task('scripts', function () {
return gulp.src(config.paths.js)
.pipe(jshint())
.pipe(jshint.reporter('default'))
.pipe(concat('main.js'))
.pipe(gulp.dest(assets + '/js/'))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest(assets + '/js/'));
});
gulp.task('styles', function () {
return gulp.src(config.paths.css)
.pipe(sass().on('error', sass.logError))
.pipe(concat('main.css'))
.pipe(gulp.dest(assets + '/css/'))
.pipe(rename({suffix: '.min'}))
.pipe(cssnano())
.pipe(gulp.dest(assets + '/css/'));
});
gulp.task('fonts', function () {
return gulp.src(config.paths.fonts)
.pipe(gulp.dest(assets + '/fonts/'));
});
gulp.task('images', function () {
return gulp.src(config.paths.images)
.pipe(gulp.dest(assets + '/images/'));
});
gulp.task('watch', function () {
gulp.watch('src/sass/**/*.scss', ['styles']);
gulp.watch('src/js/**/*.js', ['scripts']);
});
// Clean
gulp.task('clean', function () {
return del([assets + '/css', assets + '/js', assets + '/fonts', assets + '/images']);
});
// Default task
gulp.task('default', ['clean'], function () {
gulp.start('styles', 'scripts', 'fonts', 'images');
});