forked from oupala/apaxy
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.js
65 lines (55 loc) · 1.76 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
/**
* Created by thomas on 08/03/16.
*/
var gulp = require('gulp');
var uglify = require('gulp-uglify');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var uglifycss = require('gulp-uglifycss');
var imageResize = require('gulp-image-resize');
var rename = require("gulp-rename");
var fs = require('fs-extra');
//Generate minified JS and CSS
gulp.task('default', ["js", "sass"]);
//Generate minified JS
gulp.task('js', function() {
return gulp.src(['photopache/theme/js/*.js'])
//.pipe(uglify())
.pipe(concat("photopache.min.js"))
.pipe(gulp.dest('photopache/theme/'));
});
//Generate minified CSS
gulp.task('sass', function () {
var myBowerUbuntu = "node_modules/ubuntu-fontface/fonts/ubuntu-condensed-webfont.";
var myFontDestOrig = "photopache/theme/fonts/";
fs.removeSync(myFontDestOrig);
fs.mkdirsSync(myFontDestOrig);
myFontDestOrig += "ubuntu-condensed-webfont.";
fs.copySync(myBowerUbuntu + "eot", myFontDestOrig + "eot");
fs.copySync(myBowerUbuntu + "svg", myFontDestOrig + "svg");
fs.copySync(myBowerUbuntu + "ttf", myFontDestOrig + "ttf");
fs.copySync(myBowerUbuntu + "woff", myFontDestOrig + "woff");
return gulp.src(['photopache/theme/sass/theme.scss'])
.pipe(sass())
.pipe(uglifycss({
"uglyComments": true
}))
.pipe(concat("photopache.min.css"))
.pipe(gulp.dest('photopache/theme/'));
});
//Clear all thumbnail
gulp.task('clear', function ()
{
fs.removeSync('photopache/photos/**/*thumbnail*');
});
//Generate thumbnail for each picture
gulp.task('thumb', ['clear'], function ()
{
gulp.src('photopache/photos/**/*.+(jpeg|JPEG|jpg|JPG|png|PNG|gif|GIF)')
.pipe(imageResize({
height : 150,
quality:0.75
}))
.pipe(rename(function (path) { path.basename += "-thumbnail"; }))
.pipe(gulp.dest('photopache/photos/'));
});