-
Notifications
You must be signed in to change notification settings - Fork 19
/
Copy pathgulpfile.js
51 lines (45 loc) · 1.44 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
// jshint ignore: start
var gulp = require('gulp'),
rimraf = require('rimraf'),
concat = require('gulp-concat'),
sass = require('gulp-ruby-sass'),
notify = require('gulp-notify'),
uglifycss = require('gulp-uglifycss'),
uglify = require('gulp-uglify');
var config = {
srcName: 'main',
libName: 'slate',
fontPath: './lib/fonts',
sassPath: './lib/sass',
extPath: './external',
jsPath: './lib/js',
distPath: './dist'
};
gulp.task('clean', function(cb) {
rimraf(config.distPath, cb);
});
gulp.task('css', function() {
return sass(config.sassPath + '/' + config.srcName + '.scss')
.on("error", notify.onError(function (error) {
return "Error: " + error.message;
}))
.pipe(concat(config.libName + '.css'))
.pipe(gulp.dest(config.distPath + '/css'))
.pipe(concat(config.libName + '.min.css'))
.pipe(uglifycss())
.pipe(gulp.dest(config.distPath + '/css'));
});
gulp.task('js', function() {
return gulp.src([config.extPath + '/*/*.js', config.jsPath + '/*.js'])
.pipe(concat(config.libName + '.js'))
.pipe(gulp.dest(config.distPath + '/js'))
.pipe(uglify())
.pipe(concat(config.libName + '.min.js'))
.pipe(gulp.dest(config.distPath + '/js'));
});
gulp.task('fonts', function() {
return gulp.src(config.fontPath + '/*')
.pipe(gulp.dest(config.distPath + '/fonts'));
});
gulp.task('build', ['css', 'js', 'fonts']);
gulp.task('default', ['build']);