-
Notifications
You must be signed in to change notification settings - Fork 0
/
gulpfile.js
110 lines (98 loc) · 2.79 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
110
var gulp = require('gulp');
var sass = require('gulp-sass');
var sourcemaps = require('gulp-sourcemaps');
var autoprefixer = require('gulp-autoprefixer');
var concat = require('gulp-concat');
var cssnano = require('gulp-cssnano');
var bsConfig = require("gulp-bootstrap-configurator");
var rev = require("gulp-rev");
var uglify = require('gulp-uglify');
var babel = require('gulp-babel');
// NOTES:
// I'm currently not using gulp-rev but I'll add it in eventually
//
//
gulp.task('styles', function() {
gulp.src('src/stylesheets/*.scss')
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'nested', // libsass doesn't support expanded yet
precision: 10,
includePaths: ['.']
}).on('error', sass.logError))
.pipe(concat('style.css'))
.pipe(cssnano())
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(sourcemaps.write('.'))
.pipe(gulp.dest('./dist/'));
});
gulp.task('js', function() {
gulp.src('src/scripts/*.js')
.pipe(concat('app.js'))
.pipe(babel({
presets: ['env']
}))
.pipe(uglify())
.on('error', function(error){
console.log(error);
})
.pipe(gulp.dest('./dist/'))
});
// BOOTSTRAP TASKS
// For CSS
gulp.task('make-bootstrap-css', function(){
return gulp.src("./config.json")
.pipe(bsConfig.css())
.pipe(cssnano())
.pipe(autoprefixer({
browsers: ['last 2 versions'],
cascade: false
}))
.pipe(gulp.dest("./dist"));
});
// For JS
gulp.task('make-bootstrap-js', function(){
return gulp.src("./config.json")
.pipe(bsConfig.js())
.pipe(uglify())
.pipe(gulp.dest("./dist"));
});
// FOR OTHER VENDORS
gulp.task('copy', function () {
// Jquery
gulp.src('./node_modules/jquery/dist/jquery.min.js')
.pipe(gulp.dest('./dist/'));
// Jquery FitText
gulp.src('./node_modules/textillate/assets/jquery.fittext.js')
.pipe(gulp.dest('./dist/'));
// Jquery Lettering
gulp.src('./node_modules/letteringjs/jquery.lettering.js')
.pipe(gulp.dest('./dist/'));
// Jquery Textillate
gulp.src('./node_modules/textillate/jquery.textillate.js')
.pipe(gulp.dest('./dist/'));
// Jquery FullPage.js
gulp.src('./node_modules/fullpage.js/dist/jquery.fullpage.min.js')
.pipe(gulp.dest('./dist/'));
// Jquery FullPage.css
gulp.src('./node_modules/fullpage.js/dist/jquery.fullpage.min.css')
.pipe(gulp.dest('./dist/'));
// Animate CSS
gulp.src('./node_modules/textillate/assets/animate.css')
.pipe(gulp.dest('./dist/'));
});
// gulp (watch)
gulp.task('default',function() {
gulp.start('styles');
gulp.start('js');
gulp.start('make-bootstrap-css');
gulp.start('make-bootstrap-js');
gulp.start('copy');
gulp.watch('src/stylesheets/*.scss',['styles']);
gulp.watch('src/stylesheets/*/*.scss',['styles']);
gulp.watch('src/scripts/*.js',['js']);
gulp.watch('./config.json',['make-bootstrap-css', 'make-bootstrap-js']);
});