forked from blackfyre/grayscale-sass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gulpfile.js
83 lines (73 loc) · 2.45 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
/**
* Created by Meki on 2015.02.25..
*/
/* Get dependencies */
var gulp = require('gulp'),
sass = require('gulp-ruby-sass'),
minifycss = require('gulp-minify-css'),
jshint = require('gulp-jshint'),
uglify = require('gulp-uglify'),
imagemin = require('gulp-imagemin'),
rename = require('gulp-rename'),
concat = require('gulp-concat'),
notify = require('gulp-notify'),
cache = require('gulp-cache'),
del = require('del');
/* Set paths */
var paths = {
/* Source paths */
styles: ['assets/sass/main.scss'],
scripts: [
'assets/bower_components/jquery/dist/jquery.js',
'assets/bower_components/jquery.easing/js/jquery.easing.js',
'assets/bower_components/bootstrap/dist/js/bootstrap.js',
'assets/js/grayscale.js'
],
images: ['assets/images/**/*'],
fonts: [
'assets/bower_components/bootstrap/fonts/*',
'assets/bower_components/font-awesome/fonts/*'
],
/* Output paths */
stylesOutput: 'styles',
scriptsOutput: 'js',
imagesOutput: 'images',
fontsOutput: 'fonts'
};
/* Tasks */
gulp.task('styles', function() {
return sass(paths.styles,{ style: 'expanded' })
.pipe(gulp.dest(paths.stylesOutput))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest(paths.stylesOutput))
.pipe(notify({ message: 'Styles task complete' }));
});
gulp.task('scripts', function() {
return gulp.src(paths.scripts)
.pipe(jshint('.jshintrc'))
.pipe(jshint.reporter('default'))
.pipe(concat('main.js'))
.pipe(gulp.dest(paths.scriptsOutput))
.pipe(rename({suffix: '.min'}))
.pipe(uglify())
.pipe(gulp.dest(paths.scriptsOutput))
.pipe(notify({ message: 'Scripts task complete' }));
});
gulp.task('images', function() {
return gulp.src(paths.images)
.pipe(cache(imagemin({ optimizationLevel: 5, progressive: true, interlaced: true })))
.pipe(gulp.dest(paths.imagesOutput))
.pipe(notify({ message: 'Images task complete' }));
});
gulp.task('fonts', function() {
return gulp.src(paths.fonts)
.pipe(gulp.dest(paths.fontsOutput))
.pipe(notify({ message: 'Fonts task complete', onLast: true }));
});
gulp.task('clean', function(cb) {
del([paths.stylesOutput, paths.scriptsOutput, paths.imagesOutput, paths.fontsOutput], cb)
});
gulp.task('default', ['clean'], function() {
gulp.start('styles', 'scripts', 'images', 'fonts');
});