-
Notifications
You must be signed in to change notification settings - Fork 2
/
gulpfile.ls
122 lines (103 loc) · 2.53 KB
/
gulpfile.ls
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
require! {
\./package.json : npm
\vinyl-transform
\vinyl-source-stream : source
browserify
babelify
gulp
\gulp-babel : babel
\gulp-uglify
\gulp-watch
\gulp-live-server
\gulp-concat-util : concat
\gulp-livescript
\gulp-remarkable
\gulp-react : react
\gulp-stylus
\gulp-cssmin
\gulp-gh-pages
}
const WWW = \./_www/
const CHARSET = '@charset "UTF-8";\n'
const HAN-VERSION = npm.dependencies.['han-css'].replace( /^[\^\~]/, '' )
src = gulp.src
dest = gulp.dest
gulp.task \deploy <[ min ]> ->
src \./_www/**/*
.pipe gulp-gh-pages!
gulp.task \server !->
server = gulp-live-server.static WWW, 7654
server.start!
gulp.task \app <[ html js css lib ]>
gulp.task \www <[ data app ]>
gulp.task \default <[ www ]>
gulp.task \min <[ www ]> -> gulp.start <[ html:date uglify cssmin ]>
gulp.task \dev <[ www server ]> ->
gulp.watch './app/**/*.html' <[ html ]>
gulp.watch './*.md' <[ html ]>
gulp.watch './app/*.{js,jsx}' <[ js ]>
gulp.watch './app/css/*.styl' <[ css ]>
gulp.task \lib ->
src \./app/lib/**/*
.pipe dest WWW
gulp.task \js ->
browserify {
entries: \./app/main.js
debug: yes
}
.add require.resolve \babelify/polyfill
.transform babelify
.bundle!
.pipe source \./main.js
.pipe dest WWW
gulp.task \uglify ->
src "#{WWW}/main.js"
.pipe gulp-uglify {
output: { ascii_only: yes }
}
.pipe dest WWW
gulp.task \css ->
src \./app/css/index.styl
.pipe gulp-stylus!
.pipe concat.header CHARSET
.pipe concat \style.css
.pipe dest WWW
src \./app/css/ruby.styl
.pipe gulp-stylus!
.pipe concat.header CHARSET
.pipe concat \han.ruby.css
.pipe dest "./app/lib/#{HAN-VERSION}"
gulp.task \cssmin ->
src "#{WWW}/**/*.css"
.pipe gulp-cssmin!
.pipe dest WWW
# Data
gulp.task \data ->
src \./data/*
.pipe dest WWW + \data
# Markdown
gulp.task \md <[ md:cp ]>
gulp.task \md:parse ->
src \./about.md
.pipe gulp-remarkable preset: \commonmark
.pipe dest \./
gulp.task \md:cp <[ md:parse ]> ->
src <[ ./app/template/intro.html ./about.html ./app/template/outro.html ]>
.pipe concat \about.html
.pipe dest \./app
# HTML
gulp.task \html <[ html:date ]>
gulp.task \html:cp <[ md ]> ->
src \./app/*.html
.pipe dest WWW
src \./CNAME
.pipe dest WWW
gulp.task \html:date <[ html:cp ]> ->
<[ index about ]>
.forEach ( page ) ->
src "#{WWW}#{page}.html"
.pipe concat "#{page}.html", {
process: ( src ) ->
src.replace( /\?\{now\}/gi, "?#{Date.now()}" )
}
.pipe dest WWW