forked from ntt-developers/ntt-tech-conference
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgulpfile.coffee
80 lines (69 loc) · 2.11 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
80
gulp = require('gulp')
mainBowerFiles = require('main-bower-files')
$ = require('gulp-load-plugins')()
app = '.'
src = app + '/src'
config =
input:
slim: src + '/slim/*.slim'
scss: src + '/scss/*.scss'
coffee: src + '/coffee/*.coffee'
font: app + '/bower_components/fontawesome/fonts/fontawesome-webfont.*'
output:
html: app + '/'
css: app + '/assets/stylesheets/'
js: app + '/assets/javascripts/'
font: app + '/assets/fonts/'
gulp.task 'slim', ->
gulp.src(config.input.slim)
.pipe($.slim({
pretty: true,
require: 'slim/include',
options: 'include_dirs=["./src/slim"]'
}))
.pipe(gulp.dest(config.output.html))
gulp.task 'scss', ->
gulp.src(config.input.scss)
.pipe($.sass())
.pipe($.concat('application.min.css'))
.pipe($.minifyCss({ keepSpecialComments: 0 }))
.pipe(gulp.dest(config.output.css))
gulp.task 'coffee', ->
gulp.src(config.input.coffee)
.pipe($.coffee({ bare: true }))
.pipe($.concat('application.min.js'))
.pipe($.uglify())
.pipe(gulp.dest(config.output.js))
gulp.task 'bower_scss', ->
gulp.src(mainBowerFiles({ filter: '**/*.scss' }))
.pipe($.sass())
.pipe($.concat('bower_components.min.css'))
.pipe($.minifyCss({ keepSpecialComments: 0 }))
.pipe(gulp.dest(config.output.css))
gulp.task 'bower_js', ->
gulp.src([mainBowerFiles({ filter: '**/jquery.js' })..., mainBowerFiles({ filter: '**/tether.js' })..., mainBowerFiles({ filter: '**/bootstrap.js' })...])
.pipe($.concat('bower_components.min.js'))
.pipe($.uglify())
.pipe(gulp.dest(config.output.js))
gulp.task 'bower_font', ->
gulp.src(config.input.font)
.pipe(gulp.dest(config.output.font))
gulp.task 'watch', ->
gulp.watch(config.input.slim, ['slim'])
gulp.watch(config.input.scss, ['scss'])
gulp.watch(config.input.coffee, ['coffee'])
gulp.task 'webserver', ->
gulp.src(app)
.pipe($.webserver({ host: '0.0.0.0' }))
gulp.task 'default', [
'slim',
'scss',
'coffee',
'bower_scss',
'bower_js',
'bower_font'
]
gulp.task 'development', [
'webserver',
'watch'
]