forked from callmenick/responsive-tabs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
83 lines (74 loc) · 1.89 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
(function() {
'use strict'
/**
* Requirements
*/
var gulp = require('gulp');
var autoprefixer = require('gulp-autoprefixer');
var cssmin = require('gulp-cssmin');
var concat = require('gulp-concat');
var jshint = require('gulp-jshint');
var notify = require("gulp-notify");
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var stylish = require('jshint-stylish');
var uglify = require('gulp-uglify');
/**
* Paths
*/
var paths = {
sass: ['./sass/**/*.scss'],
scripts: ['./js/src/**/*.js']
};
/**
* Styles
*/
gulp.task('styles', function() {
return gulp.src(paths.sass)
.pipe(sass({
outputStyle: 'expanded'
}))
.on('error', notify.onError({
title: 'Error compiling Sass',
message: 'Check the console for info'
}))
.on('error', sass.logError)
.pipe(autoprefixer())
.pipe(gulp.dest('./css'))
.pipe(cssmin())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('./css'));
});
/**
* Styles watcher
*/
gulp.task('styles:watch', function() {
gulp.watch(paths.sass, ['styles']);
});
/**
* Scripts linting
*/
gulp.task('lint', function() {
return gulp.src(paths.scripts)
.pipe(jshint())
.pipe(jshint.reporter(stylish))
.pipe(jshint.reporter('fail'))
.on('error', notify.onError({
title: 'JS hint failed',
message: 'Check the console for errors'
}));
});
/**
* Scripts dev
*/
gulp.task('scripts:watch', function() {
gulp.watch(paths.scripts, ['lint']);
});
/**
* Final tasks - these are the tasks that should be run from the command line,
* as they encompass the above.
*/
gulp.task('default', ['styles', 'lint', 'styles:watch', 'scripts:watch']);
gulp.task('styles:dev', ['styles', 'styles:watch']);
gulp.task('scripts:dev', ['lint', 'scripts:watch']);
})();