-
Notifications
You must be signed in to change notification settings - Fork 4
/
gulpfile.js
76 lines (68 loc) · 2.32 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');
var gutil = require('gulp-util');
var concat = require('gulp-concat');
var sass = require('gulp-sass');
var coffee = require('gulp-coffee');
var cleanCSS = require('gulp-clean-css');
var rename = require('gulp-rename');
var wrap = require('gulp-wrap');
var uglify = require('gulp-uglify');
var spritesmith = require('gulp.spritesmith');
var paths = {
sass: ['./scss/**/*.scss'],
coffee: ['./coffee/**/*.coffee'],
translations: ['./translations/*.json'],
libraries: [
'./lib/ionic/js/ionic.bundle.min.js',
'./lib/angular-cache/dist/angular-cache.min.js',
'./lib/angular-translate/angular-translate.min.js'
]
};
gulp.task('default', ['sprites','sass', 'coffee', 'translations', 'libraries']);
gulp.task('sprites', function(done) {
var spriteData = gulp.src('./images/sets/*.png').pipe(spritesmith({
imgName: 'sets.png',
imgPath: '../images/sets.png',
cssName: 'sets.min.css',
cssSpritesheetName: 'icon-sets',
cssTemplate: './scss/sets-template.handlebars'
}));
spriteData.img.pipe(gulp.dest('./images/'));
spriteData.css
.pipe(cleanCSS())
.pipe(gulp.dest('./css/'))
.on('end', done);
});
gulp.task('sass', function(done) {
gulp.src(paths.sass)
.pipe(sass({errLogToConsole: true}))
//.pipe(cleanCSS())
.pipe(rename({extname: '.min.css'}))
.pipe(gulp.dest('./css/'))
.on('end', done);
});
gulp.task('coffee', function() {
gulp.src(paths.coffee)
.pipe(coffee({bare: true}).on('error', gutil.log))
.pipe(uglify())
.pipe(concat('app.min.js'))
.pipe(gulp.dest('./js/'))
});
gulp.task('translations', function() {
gulp.src(paths.translations)
.pipe(wrap("$translateProvider.translations('<%= file.relative.split('.')[0] %>', <%= contents %>);",null,{parse:false}))
.pipe(concat('translations.min.js'))
.pipe(wrap('angular.module("judgebooth.translations", ["pascalprecht.translate"]).config(["$translateProvider", function($translateProvider) {<%= contents %>}]);'))
.pipe(uglify())
.pipe(gulp.dest('./js/'));
});
gulp.task('libraries', function() {
gulp.src(paths.libraries)
.pipe(concat('lib.min.js'))
.pipe(gulp.dest('./js/'))
});
gulp.task('watch', ['default'], function() {
gulp.watch(paths.sass, ['sass']);
gulp.watch(paths.coffee, ['coffee']);
gulp.watch(paths.translations, ['translations']);
});