-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
62 lines (50 loc) · 1.24 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
/* jshint globalstrict: true */
/* globals require */
'use strict';
function getAllFuncs() {
var funcsArray = [];
for (var x in funcs) {
funcsArray.push(funcs[x]);
}
return funcsArray;
}
var gulp = require('gulp'),
sass = require('gulp-sass'),
autoprefixer = require('gulp-autoprefixer'),
livereload = require('gulp-livereload'),
resourcesPath = 'assetuse/resources/',
srcPath = resourcesPath + 'src/',
distPath = resourcesPath + 'dist/',
funcs = {
sass: 'sass',
js: 'js',
watch: 'watch'
}
;
// Compile Our Sass
gulp.task(funcs.sass, function() {
return gulp.src(srcPath + 'sass/main.scss')
.pipe(sass({
outputStyle: 'expanded',
}).on('error', sass.logError))
.pipe(autoprefixer({
browsers: ['last 2 versions', '> 1%', 'ie >= 9'],
cascade: false
}))
.pipe(gulp.dest(distPath + 'css'))
.pipe(livereload());
});
// Libraries
gulp.task(funcs.js, function() {
return gulp.src(srcPath + 'js/main.js')
.pipe(gulp.dest(distPath + 'js'))
.pipe(livereload());
});
// Watch Files For Changes
gulp.task(funcs.watch, function() {
livereload.listen();
gulp.watch(srcPath + 'sass/*.scss', [funcs.sass]);
gulp.watch(srcPath + 'js/*.js', [funcs.js]);
});
// Default Task
gulp.task('default', getAllFuncs());