-
Notifications
You must be signed in to change notification settings - Fork 3
/
gulpfile.js
53 lines (47 loc) · 1.28 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
// require gulp
var gulp = require('gulp');
// require other packages
var concat = require('gulp-concat');
var rename = require("gulp-rename");
var sass = require('gulp-sass');
var uglify = require('gulp-uglify');
var cssnano = require('gulp-cssnano');
var theme = "./wp-content/themes/piratar";
////////// tasks
// concat and minify scripts task
gulp.task('scripts', function() {
gulp.src([
'./components/jquery/dist/jquery.js',
'./components/jquery-instagram/dist/instagram.js',
//'./components/bootstrap/dist/js/bootstrap.js',
theme + '/js/site.js'
])
.pipe(concat('piratar.js'))
.pipe(gulp.dest(theme + '/js/'))
.pipe(uglify())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(theme + '/js/'))
});
//compile and minify less styles task
gulp.task('styles', function(){
gulp.src([
theme + '/css/*.scss'
])
.pipe(concat('piratar.scss'))
.pipe(sass())
.pipe(gulp.dest(theme + '/css/'))
.pipe(cssnano())
.pipe(rename({
suffix: '.min'
}))
.pipe(gulp.dest(theme + '/css/'))
});
//watch task
gulp.task('watch', function(){
gulp.watch(theme + '/js/site.js', ['scripts']);
gulp.watch(theme + '/css/*.scss', ['styles']);
});
//define default task
gulp.task('default', ['scripts', 'styles', 'watch']);