forked from aroc/side-comments
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
55 lines (49 loc) · 1.62 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
var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var minifycss = require('gulp-minify-css');
var less = require('gulp-less');
var prefix = require('gulp-autoprefixer');
var rename = require('gulp-rename');
var paths = {
scripts: ['build/*.js'],
themes: ['css/themes/*.less']
};
gulp.task('scripts', function() {
// Minify and copy all JavaScript (except vendor scripts)
return gulp.src(paths.scripts)
.pipe(rename('side-comments.js'))
.pipe(gulp.dest("./release"))
.pipe(uglify())
.pipe(rename('side-comments.min.js'))
.pipe(gulp.dest("./release"));
});
gulp.task('base-styles', function () {
return gulp.src('css/base.less')
.pipe(less())
.pipe(prefix({ cascade: true }))
.pipe(rename('styles.css'))
.pipe(gulp.dest("./css"))
.pipe(rename('side-comments.css'))
.pipe(gulp.dest("./release"))
.pipe(minifycss())
.pipe(rename('side-comments.min.css'))
.pipe(gulp.dest("./release/"));
});
gulp.task('theme-styles', function () {
return gulp.src(paths.themes)
.pipe(less())
.pipe(prefix({ cascade: true }))
.pipe(rename('default-theme.css'))
.pipe(gulp.dest("./release/themes"))
.pipe(minifycss())
.pipe(rename('default-theme.min.css'))
.pipe(gulp.dest("./release/themes"));
});
// Rerun the task when a file changes
gulp.task('watch', function() {
gulp.watch(paths.scripts, ['scripts']);
gulp.watch(['css/*.less', 'css/themes/*.less'], ['base-styles', 'theme-styles']);
});
// The default task (called when you run `gulp` from cli)
gulp.task('default', ['scripts', 'base-styles', 'theme-styles', 'watch']);