forked from bergwerk/bwrk_onepage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
62 lines (50 loc) · 1.58 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
// Gulp Modules
var gulp = require('gulp'),
uglify = require('gulp-uglify'),
concat = require('gulp-concat'),
path = require('path'),
watch = require('gulp-watch'),
plumber = require('gulp-plumber'),
rename = require('gulp-rename'),
sass = require('gulp-sass');
var defaultTasks = [
'styles',
'scripts',
'watch'
];
var jsFilesApp = [
'Resources/Private/Src/Js/singlePageNav.js',
'Resources/Private/Src/Js/custom.js'
];
gulp.task('styles', stylesTask);
gulp.task('scripts', scriptsTask);
gulp.task('watch', watchTask);
gulp.task('default', defaultTasks);
function watchTask() {
gulp.watch('Resources/Private/Src/Scss/**/*.scss', ['styles']);
gulp.watch(jsFilesApp, ['scripts']);
}
function stylesTask() {
var compileStyles = function (_baseName) {
gulp.src(['Resources/Private/Src/Scss/' + _baseName + '.scss'])
.pipe(plumber())
.pipe(sass({outputStyle: 'expanded'}))
.pipe(gulp.dest('Resources/Public/Css'))
.pipe(rename({suffix: '.min'}))
.pipe(sass({outputStyle: 'compressed'}))
.pipe(gulp.dest('Resources/Public/Css'));
};
compileStyles('main');
}
function scriptsTask() {
var compileScripts = function (files, targetFile) {
gulp.src(files)
.pipe(plumber())
.pipe(concat(targetFile + '.js'))
.pipe(gulp.dest('Resources/Public/Js'))
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('Resources/Public/Js'));
};
compileScripts(jsFilesApp, 'main');
}