-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
53 lines (42 loc) · 1.48 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
/*jslint node:true */
'use strict';
var gulp = require('gulp'),
del = require('del'),
concat = require('gulp-concat'),
rename = require('gulp-rename'),
uglify = require('gulp-uglify'),
sass = require('gulp-sass'),
watch = require('gulp-watch'),
livereload = require('gulp-livereload'),
minifyCss = require('gulp-minify-css'),
autoprefixer = require('gulp-autoprefixer');
gulp.task('styles', function() {
return gulp.src('src/sass/*.scss')
.pipe(sass({outputStyle: 'expanded', unix_newlines: true, linefeed: "lf"}).on('error', sass.logError))
.pipe(autoprefixer())
.pipe(minifyCss({
keepSpecialComments: 1
}))
.pipe(rename("theme.min.css"))
.pipe(gulp.dest('./assets/css/'));
});
gulp.task('scripts', function() {
return gulp.src(['src/js/plugin/*.js', 'src/js/base.js'])
.pipe(uglify())
.pipe(concat('theme.min.js'))
.pipe(gulp.dest('assets/js'));
});
gulp.task('ghost_config', ['scripts'], function() {
return gulp.src(['src/js/config.js', 'assets/js/theme.min.js'])
.pipe(concat('theme.min.js'))
.pipe(gulp.dest('assets/js'));
});
gulp.task('default', function() {
gulp.start('styles', 'scripts', 'ghost_config', 'watch');
});
gulp.task('watch', function() {
gulp.watch('src/sass/*.scss', ['styles']);
gulp.watch('src/js/*.js', ['scripts', 'ghost_config']);
livereload.listen();
gulp.watch(['*']).on('change', livereload.changed);
});