This repository has been archived by the owner on Jan 17, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.js
60 lines (52 loc) · 1.99 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
var gulp = require('gulp'),
sass = require('gulp-ruby-sass')
notify = require("gulp-notify")
uglify = require("gulp-uglify")
concat = require('gulp-concat')
mainBowerFiles = require('main-bower-files')
bower = require('gulp-bower');
var config = {
sassPath: './public/stylesheets/sass',
jsPath: './public/javascripts/libs',
bowerDir: './bower_components'
}
gulp.task('bower', function() {
return bower()
.pipe(gulp.dest(config.bowerDir))
});
gulp.task('icons', function() {
return gulp.src(config.bowerDir + '/font-awesome/fonts/**.*')
.pipe(gulp.dest('./public/stylesheets/fonts'));
});
gulp.task('javascripts', function() {
// var bowerFiles = mainBowerFiles('**/*.js');
// console.log('bower files: ', bowerFiles);
return gulp.src( mainBowerFiles('**/*.js') )
.pipe(gulp.dest('./public/javascripts/libs/'))
});
gulp.task('compile-css', function() {
return gulp.src(config.sassPath + '/site-theme.scss')
.pipe(sass({
style: 'compressed',
loadPath: [
'./public/stylesheets/sass',
config.bowerDir + '/bootstrap/scss',
config.bowerDir + '/font-awesome/scss',
]
})
.on("error", notify.onError(function (error) {
return "Error: " + error.message;
})))
.pipe(gulp.dest('./public/stylesheets'));
});
gulp.task('minify-js', function () {
return gulp.src('./public/javascripts/libs/*.js') // path to your files
.pipe(uglify())
.pipe(concat('/plugins.min.js'))
.pipe(gulp.dest('./public/javascripts/'));
});
// Rerun the task when a file changes
gulp.task('watch', function() {
gulp.watch(config.sassPath + '/**/*.scss', ['compile-css']);
});
gulp.task('default', ['bower', 'icons', 'javascripts', 'compile-css', 'minify-js']);