-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgulpfile.js
More file actions
104 lines (89 loc) · 3.29 KB
/
gulpfile.js
File metadata and controls
104 lines (89 loc) · 3.29 KB
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
// dependencies
var gulp = require('gulp');
var htmlmin = require('gulp-htmlmin'); // minify html
var cssmin = require('gulp-cssmin'); // minify css
var rename = require('gulp-rename'); // rename file
var uglify = require('gulp-uglify'); //minify js
var browserSync = require('browser-sync').create(); // run a local version with livereload (it will automatiucally reload the page when you change something on your code)
var jshint = require('gulp-jshint');
var stylish = require('jshint-stylish');
var image = require('gulp-image');
var deploy = require('gulp-deploy-git');
var ghPages = require('gulp-gh-pages');
gulp.task('deploy', function() {
return gulp.src('./dist/**/*')
.pipe(ghPages());
});
gulp.task('imageMin', function () {
gulp.src('img/**/*')
.pipe(image())
.pipe(gulp.dest('dist/img'));
});
gulp.task('hint', function () {
return gulp.src('js/*.js')
.pipe(jshint())
.pipe(jshint.reporter(stylish));
});
// task to minify your html
gulp.task('html', function () {
return gulp.src('index.html') // you should change the source to fit into you project
.pipe(htmlmin({
collapseWhitespace: true
})) // runs htmlmin
.pipe(gulp.dest('dist')) // where the files goes after the task is completed
});
// taks to minify css
gulp.task('cssMain', function () {
gulp.src('css/*.css') // you should change the source to fit into you project
.pipe(cssmin()) // runs cssmin
//.pipe(rename({suffix: '.min'})) // add a sufix 'min' (main.css -> main.min.css)
.pipe(gulp.dest('dist/css')); // where the files goes after the task is completed
});
// taks to minify css
gulp.task('fancycss', function () {
gulp.src('js/fancybox/*.css') // you should change the source to fit into you project
.pipe(cssmin()) // runs cssmin
//.pipe(rename({suffix: '.min'})) // add a sufix 'min' (main.css -> main.min.css)
.pipe(gulp.dest('dist/js/fancybox')); // where the files goes after the task is completed
});
// taks to minify css
gulp.task('css', function () {
gulp.src('skin/*.css') // you should change the source to fit into you project
.pipe(cssmin()) // runs cssmin
//.pipe(rename({suffix: '.min'})) // add a sufix 'min' (main.css -> main.min.css)
.pipe(gulp.dest('dist/skin')); // where the files goes after the task is completed
});
gulp.task('compressMain', function () {
return gulp.src('js/*.js')
.pipe(uglify())
.pipe(gulp.dest('dist/js'));
});
gulp.task('compress', function () {
return gulp.src('js/fancybox/*.js')
.pipe(uglify())
.pipe(gulp.dest('dist/js/fancybox'));
});
gulp.task('copy', function () {
gulp.src('fonts/**/*')
.pipe(gulp.dest('dist/fonts'));
gulp.src('fonts/fontawesome')
.pipe(gulp.dest('dist/fonts/fontawesome'));
});
gulp.task('serve', function () {
// Serve files from the root of this project
browserSync.init({
server: {
baseDir: "./"
}
});
});
gulp.task('run', function () {
// Serve files from the root of this project
browserSync.init({
server: {
baseDir: "./"
}
});
});
gulp.task('build', ['html', 'css', 'compress', 'imageMin', 'fancycss', 'cssMain', 'compressMain', 'copy']);
gulp.task('default', ['build']);