-
Notifications
You must be signed in to change notification settings - Fork 1
/
gulpfile.coffee
79 lines (64 loc) · 2.43 KB
/
gulpfile.coffee
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
"use sct"
bower = require('bower')
sh = require('shelljs')
gulp = require("gulp")
$ = require("gulp-load-plugins")(lazy: false)
$run = require('run-sequence')
$logger = $.util.log
paths =
styles: ['./app/styles/ionic.app.scss']
scripts: ['./app/scripts/**/*.coffee']
views: ['./app/views/**/*.jade']
assets: ['./app/assets/**']
gulp.task "copy", ->
gulp.src(paths.assets)
.pipe(gulp.dest('./www/'))
gulp.task 'sass', (done) ->
gulp.src(paths.styles)
.pipe($.plumber(errorHandler: $.notify.onError("Error: <%= error.message %>")))
.pipe($.sass(errLogToConsole: true))
.pipe($.concat('style.css'))
.pipe(gulp.dest('./www/css'))
.pipe($.minifyCss(keepSpecialComments: 0))
.pipe($.rename(extname: '.min.css'))
.pipe(gulp.dest('./www/css/'))
.pipe($.size(showFiles: true))
gulp.task 'coffee', (done) ->
gulp.src(paths.scripts)
.pipe($.plumber(errorHandler: $.notify.onError("Error: <%= error.message %>")))
.pipe($.coffee(bare: false).on('error', $logger))
.pipe($.jshint(".jshintrc"))
.pipe($.jshint.reporter('jshint-stylish'))
.pipe($.concat('app.js'))
.pipe($.insert.prepend("'use strict';\n"))
.pipe(gulp.dest('./www/js'))
.pipe($.size(showFiles: true))
gulp.task 'jade', (done) ->
gulp.src(paths.views)
.pipe($.plumber(errorHandler: $.notify.onError("Error: <%= error.message %>")))
.pipe($.jade())
.pipe(gulp.dest('./www/templates'))
.pipe($.angularTemplatecache('templates', {standalone:true, root: '/templates/'} ))
.pipe($.rename(extname: '.js'))
.pipe(gulp.dest('./www/js'))
.pipe($.size(showFiles: true))
gulp.task 'watch', ->
gulp.watch(paths.styles, ['sass'])
gulp.watch(paths.scripts, ['coffee'])
gulp.watch(paths.views, ['jade'])
gulp.task 'build', (callback) ->
$run("sass", "coffee", "jade", callback)
gulp.task('default', ['build']);
gulp.task 'install', ['git-check'], ->
bower.commands.install().on 'log', (data) ->
$logger('bower', $.util.colors.cyan(data.id), data.message)
gulp.task 'git-check', (done) ->
if !sh.which('git')
console.log(
' ' + $.util.colors.red('Git is not installed.'),
'\n Git, the version control system, is required to download Ionic.',
'\n Download git here:', $.util.colors.cyan('http://git-scm.com/downloads') + '.',
'\n Once git is installed, run \'' + $.util.colors.cyan('gulp install') + '\' again.'
)
process.exit(1)
done()