-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.js
executable file
·76 lines (67 loc) · 2.31 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
var gulp = require('gulp'),
sass = require('gulp-sass')
notify = require('gulp-notify')
browsersync = require('browser-sync').create()
concat = require('gulp-concat')
moduleImporter = require('sass-module-importer')
sourcemaps = require('gulp-sourcemaps')
data = require('gulp-data')
path = require('path')
jade = require('gulp-jade');
var config = {
sassPath: './resources/sass',
nodeDir: './node_modules'
}
gulp.task('icons', function() {
return gulp.src([
config.nodeDir + '/font-awesome/fonts/**.*',
config.nodeDir + '/bootstrap-sass/assets/fonts/bootstrap/**.*'
])
.pipe(gulp.dest('./public/fonts'));
});
gulp.task('js', function(){
return gulp.src([
config.nodeDir + '/jquery/dist/jquery.min.js',
config.nodeDir + '/bootstrap-sass/assets/javascripts/bootstrap.min.js'
])
.pipe(concat('libs.js'))
.pipe(gulp.dest('./public/js'));
});
gulp.task('css', function() {
return gulp.src('./resources/sass/style.scss')
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'compressed',
importer: moduleImporter()
}).on('error', sass.logError))
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest('./public/css'));
});
gulp.task('index', function() {
return gulp.src('resources/templates/index.jade')
.pipe(data(function(file) {
return require('./resources/templates/index.json');
}))
.pipe(jade({pretty: true})) // pip to jade plugin
.pipe(gulp.dest('public')); // tell gulp our output folder
});
gulp.task('page', function() {
return gulp.src('resources/templates/page.jade')
.pipe(data(function(file) {
return require('./resources/templates/page.json');
}))
.pipe(jade({pretty: true})) // pip to jade plugin
.pipe(gulp.dest('public')); // tell gulp our output folder
});
gulp.task('watch', function() {
gulp.watch(config.sassPath + '/**/*.scss', ['css']);
gulp.watch('public/*.html').on('change', browsersync.reload);
gulp.watch('public/css/**/*.css').on('change', browsersync.reload);
gulp.watch('public/js/**/*.js').on('change', browsersync.reload);
});
gulp.task('build', ['icons', 'css', 'js','index']);
gulp.task('serve', ['css','watch'],function(){
browsersync.init({
server: "./public"
});
});