-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
64 lines (50 loc) · 1.63 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
'use strict';
var gulp = require('gulp');
var sass = require('gulp-sass');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var sourcemaps = require('gulp-sourcemaps');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
// sass -> compile & copy from scss to css
gulp.task('sass', function() {
return gulp.src('assets/scss/**/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({outputStyle: 'compressed'})
.on('error', sass.logError))
.pipe(autoprefixer())
.pipe(rename({extname: '.min.css'}))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('assets/css'))
});
// js -> concatenate from /js/scripts into scripts.min.js
gulp.task('scripts', function() {
return gulp.src('assets/js/scripts/**/*.js')
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(concat('scripts.min.js'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('assets/js'));
});
// vendor scripts
var vendorPaths = [
'node_modules/angular/angular.min.js',
'node_modules/angular-animate/angular-animate.min.js',
'node_modules/mathjs/dist/math.min.js',
'assets/js/vendor/diceroll.browser.js',
];
gulp.task('vendor-scripts', function() {
return gulp.src(vendorPaths)
.pipe(sourcemaps.init())
.pipe(uglify())
.pipe(concat('vendor.min.js'))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('assets/js'));
});
// Default -> Build errythang
gulp.task('default',['sass', 'scripts', 'vendor-scripts']);
// Watch task
gulp.task('watch',function() {
gulp.watch('assets/scss/**/*.scss',['sass']);
gulp.watch('assets/js/scripts/**/*.js',['scripts']);
});