-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
51 lines (41 loc) · 1.5 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
'use strict';
var gulp = require('gulp'),
merge = require('merge-stream'),
sass = require('gulp-sass'),
rename = require('gulp-rename'),
cssnano = require('gulp-cssnano'),
concat = require('gulp-concat'),
uglify = require('gulp-uglify');
var assetsDir = __dirname + '/assets',
cssDir = assetsDir + '/dist/css',
jsDir = assetsDir + '/dist/js';
gulp.task('sass', function () {
return gulp.src(assetsDir + '/sass/*.scss')
.pipe(sass().on('error', sass.logError))
.pipe(gulp.dest(cssDir));
});
gulp.task('css', ['sass'], function () {
return gulp.src([cssDir + '/*.css', '!' + cssDir + '/*.min.css'])
.pipe(cssnano())
.pipe(rename({extname: '.min.css'}))
.pipe(gulp.dest(cssDir));
});
gulp.task('scripts', function() {
var standalone = gulp.src(assetsDir + '/js/grido.js')
.pipe(gulp.dest(jsDir));
var bundle = gulp.src(assetsDir + '/js/**/*.js')
.pipe(concat('grido.bundle.js'))
.pipe(gulp.dest(jsDir));
return merge(standalone, bundle);
});
gulp.task('js', ['scripts'], function() {
return gulp.src([jsDir + '/*.js', '!' + jsDir + '/*.min.js'])
.pipe(uglify({preserveComments: 'license'}))
.pipe(rename({extname: '.min.js'}))
.pipe(gulp.dest(jsDir));
});
gulp.task('build', ['css', 'js']);
gulp.task('default', function () {
gulp.watch(assetsDir + '/sass/*.scss', ['css']);
gulp.watch(assetsDir + '/js/**/*.js', ['js']);
});