forked from foundation/motion-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
90 lines (78 loc) · 2.25 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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
var $ = require('gulp-load-plugins')();
var gulp = require('gulp');
var rimraf = require('rimraf').sync;
var sequence = require('run-sequence');
var supercollider = require('supercollider');
var COMPATIBILITY = [
'last 2 versions',
'ie >= 10',
'and_chr >= 2.3'
];
supercollider
.config({
template: './docs/src/_template.hbs',
extension: 'md',
marked: false,
handlebars: require('./lib/handlebars')
})
.adapter('sass');
gulp.task('clean', function(done) {
rimraf('./_build');
rimraf('./docs/*.md');
done();
});
gulp.task('docs', function() {
return gulp.src('./docs/src/*.md')
.pipe(supercollider.init())
.pipe(gulp.dest('./docs'));
});
gulp.task('sass', function() {
return gulp.src('./motion-ui.scss')
.pipe($.sass().on('error', $.sass.logError))
.pipe($.autoprefixer({
browsers: COMPATIBILITY
}))
.pipe(gulp.dest('./_build'));
});
gulp.task('javascript', function() {
return gulp.src('./motion-ui.js')
.pipe($.umd({
dependencies: function(file) {
return [{ name: 'jquery', amd: 'jquery', cjs: 'jquery', global: 'jQuery', param: '$' }];
},
exports: function(file) {
return 'MotionUI';
},
namespace: function(file) {
return 'MotionUI';
}
}))
.pipe(gulp.dest('./_build'));
});
gulp.task('dist', ['dist:sass', 'dist:javascript']);
gulp.task('dist:sass', ['sass'], function() {
return gulp.src('./_build/motion-ui.css')
.pipe(gulp.dest('./dist'))
.pipe($.minifyCss())
.pipe($.rename('motion-ui.min.css'))
.pipe(gulp.dest('./dist'));
});
gulp.task('dist:javascript', ['javascript'], function() {
return gulp.src('./_build/motion-ui.js')
.pipe(gulp.dest('./dist'))
.pipe($.uglify())
.pipe($.rename('motion-ui.min.js'))
.pipe(gulp.dest('./dist'));
});
gulp.task('build', function(done) {
sequence('clean', ['docs', 'sass', 'javascript'], done);
});
gulp.task('lint', function() {
return gulp.src('./src/**/*.scss')
.pipe($.scssLint());
})
gulp.task('default', ['build'], function() {
gulp.watch(['./docs/src/*.md', './docs/src/_template.hbs'], ['docs']);
gulp.watch(['./src/**/*.scss', './motion-ui.scss'], ['sass']);
gulp.watch('./motion-ui.js', ['javascript']);
});