-
Notifications
You must be signed in to change notification settings - Fork 7
/
Gulpfile.js
56 lines (48 loc) · 1.41 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
var gulp = require('gulp');
var babel = require('gulp-babel');
var csscomb = require('gulp-csscomb');
var csswring = require('csswring');
var header = require('gulp-header');
var postcss = require('gulp-postcss');
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var uglify = require('gulp-uglify');
gulp.task('js', function() {
var headerText = [
'/*! leipzig.js v0.8.1',
'ISC License',
'github.com/bdchauvette/leipzig.js */'
].join(' | ');
var babelConfig = {
modules: 'umd',
moduleId: 'Leipzig',
plugins: ['object-assign']
};
return gulp.src('src/*.js')
.pipe(babel(babelConfig))
.pipe(header(headerText + '\n'))
.pipe(gulp.dest('./dist'))
.pipe(rename({ suffix: '.min' }))
.pipe(uglify({ preserveComments: 'some' }))
.pipe(gulp.dest('./dist'));
});
gulp.task('comb', function() {
return gulp.src('src/*.scss')
.pipe(csscomb())
.pipe(gulp.dest('./src'));
});
gulp.task('css', function() {
return gulp.src('src/*.scss')
.pipe(csscomb())
.pipe(sass({ outputStyle: 'expanded' }))
.pipe(gulp.dest('./dist'))
.pipe(postcss([csswring]))
.pipe(rename({ suffix: '.min' }))
.pipe(gulp.dest('./dist'));
});
gulp.task('build', ['js', 'css'], function() {});
gulp.task('watch', function() {
var jsWatcher = gulp.watch('src/*.js', ['js']);
var styleWatcher = gulp.watch('src/*.scss', ['css']);
});
gulp.task('default', ['build']);