This repository has been archived by the owner on Oct 29, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
111 lines (78 loc) · 2.56 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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// ------------------------------------
// Libraries
// ------------------------------------
var fs = require('fs');
var gulp = require('gulp');
// var sass = require('gulp-sass');
var less = require('gulp-less');
var jade = require('gulp-jade');
var imagemin = require('gulp-imagemin');
var rename = require('gulp-rename');
// ------------------------------------
// Paths
// ------------------------------------
var paths = {
fonts : './src/assets/fonts/**/*',
styles : './src/assets/styles/**/*.less',
scripts : './src/assets/scripts/**/*.js',
images : './src/assets/images/**/*.{png,gif,jpeg,jpg,svg}',
templates : './src/**/*.jade',
other : './src/assets/*.pdf'
};
// ------------------------------------
// Default Task
// ------------------------------------
gulp.task('default', ['images', 'scripts', 'fonts', 'styles', 'templates']);
// ------------------------------------
// Watch Task
// ------------------------------------
gulp.task('watch', function() {
gulp.watch(paths.styles, ['styles']);
gulp.watch(paths.scripts, ['scripts']);
gulp.watch(paths.images, ['images']);
gulp.watch(paths.templates, ['templates']);
});
// ------------------------------------
// Styles Task
// ------------------------------------
gulp.task('styles', function() {
gulp.src('./src/assets/styles/index.less')
// .pipe(sass({ errLogToConsole: true, sourceComments : 'normal' }))
.pipe(less())
.pipe(rename('main.css'))
.pipe(gulp.dest('./public/assets/styles/'))
gulp.src('./src/assets/styles/reset2.css')
.pipe(gulp.dest('./public/assets/styles/'))
});
// ------------------------------------
// Fonts Task
// ------------------------------------
gulp.task('fonts', function() {
gulp.src(paths.fonts)
.pipe(gulp.dest('./public/assets/fonts/'))
});
// ------------------------------------
// Scripts Task
// ------------------------------------
gulp.task('scripts', function() {
gulp.src(paths.scripts)
.pipe(gulp.dest('./public/assets/scripts/'))
});
// ------------------------------------
// Images Task
// ------------------------------------
gulp.task('images', function() {
gulp.src(paths.images)
.pipe(imagemin())
.pipe(gulp.dest('./public/assets/images/'))
gulp.src(paths.other)
.pipe(gulp.dest('./public/assets/'))
});
// ------------------------------------
// Templates Task
// ------------------------------------
gulp.task('templates', function() {
gulp.src(paths.templates)
.pipe(jade({ pretty: true }))
.pipe(gulp.dest('./public/'))
});