forked from ffissore/presentz.org
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathassets.coffee
180 lines (167 loc) · 6.23 KB
/
assets.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
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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
###
Presentz.org - A website to publish presentations with video and slides synchronized.
Copyright (C) 2012 Federico Fissore
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
###
"use strict"
assetManager = require "connect-assetmanager"
assetHandler = require "connect-assetmanager-handlers"
coffee = require "coffee-script"
dust = require "dustjs-linkedin"
coffee_compiler = (contents, path, index, isLast, callback) ->
if /\.coffee/.test path
console.log "Compiling #{path}"
callback coffee.compile(contents)
else
callback contents
dust_compiler = (contents, path, index, isLast, callback) ->
if /\.dust/.test path
filename_parts = path.split("/")
filename = filename_parts[filename_parts.length - 1]
filename = filename.substring(0, filename.lastIndexOf("."))
console.log "Compiling #{path} (#{filename})"
callback dust.compile(contents, filename)
else
callback contents
new_js_conf = (suffix, files) ->
conf =
route: new RegExp("\/managedassets\/js\/[a-z0-9]*#{suffix}\.js")
path: "./"
dataType: "javascript"
files: files
stale: true
debug: true
preManipulate:
"^": [
coffee_compiler,
dust_compiler
]
postManipulate:
"^": [
assetHandler.uglifyJsOptimize
]
return conf
new_css_conf = (suffix, files) ->
conf =
route: new RegExp("/managedassets\/css\/[a-z0-9]+#{suffix}\.css")
path: "./"
dataType: "css"
files: files
stale: true
preManipulate:
MSIE: [
assetHandler.fixVendorPrefixes,
assetHandler.fixGradients,
assetHandler.stripDataUrlsPrefix
]
"^": [
assetHandler.fixVendorPrefixes,
assetHandler.fixGradients,
assetHandler.replaceImageRefToBase64("#{__dirname}/public/assets/img/")
]
return conf
assetsMiddleware = assetManager
js_main: new_js_conf("main", [
"public/assets/js/jquery/jquery-1.8.0.js"
"public/assets/js/jquery/jquery.easing.1.3.js"
"public/assets/js/jquery/jquery.scrollTo-1.4.2-min.js"
"public/assets/js/jquery/jquery-ui-1.8.23.custom.min.js"
"public/assets/js/modernizr.js"
"src_client/main.coffee"
"public/assets/js/piwik.js"
])
css: new_css_conf("main", [
"public/assets/css/mediaelementplayer.css"
"public/assets/css/reset.css"
"public/assets/css/default.css"
"public/assets/css/fluid_container.css"
"public/assets/css/font_style.css"
"public/assets/css/fe_style.css"
"public/assets/css/default_responsive.css"
"public/assets/css/fe_style_responsive.css"
])
js_pres: new_js_conf("pres", [
"public/assets/js/froogaloop.js"
"public/assets/js/swfobject.js"
"public/assets/js/mediaelement-and-player.js"
"public/assets/js/presentz-1.1.4.js"
"src_client/show_presentation.coffee"
])
css_pres: new_css_conf("pres", [
"public/assets/css/fe_style_pres.css"
])
js_embed: new_js_conf("embed", ["src_client/embed.coffee"])
js_manage: new_js_conf("manage", [
"node_modules/accent-folding/accent-fold.js"
"node_modules/xregexp/xregexp-all.js"
"public/assets/js/piwik.js"
"public/assets/js/jquery/jquery-1.8.0.js"
"public/assets/js/jquery/jquery-ui-1.8.23.custom.min.js"
"public/assets/js/manage/jquery.jsonp.js"
"public/assets/js/manage/jquery.movingboxes.js"
"public/assets/js/manage/bootstrap.js"
"node_modules/underscore/underscore.js"
"node_modules/underscore.string/lib/underscore.string.js"
"public/assets/js/manage/backbone.js"
"public/assets/js/manage/deep-model.js"
"public/assets/js/manage/dust-core-1.0.0.js"
"public/assets/js/manage/jsuri-1.1.1.js"
"public/assets/js/froogaloop.js"
"public/assets/js/swfobject.js"
"public/assets/js/mediaelement-and-player.js"
"public/assets/js/presentz-1.1.4.js"
"views/m/_presentation_thumb.dust"
"views/m/_presentation_menu_title_save_btn.dust"
"views/m/_presentation.dust"
"views/m/_slide.dust"
"views/m/_reset_thumb.dust"
"views/m/_img_slide_thumb.dust"
"views/m/_swf_slide_thumb.dust"
"views/m/_new.dust"
"views/m/_slide_times_preview.dust"
"views/m/_confirm_slide_delete.dust"
"views/m/_no_talks_here.dust"
"utils.coffee"
"dustjs_helpers.coffee"
"src_client_manage/backbone_extensions.coffee"
"src_client_manage/namespaces.coffee"
"src_client_manage/slide_backends/utils.coffee"
"src_client_manage/slide_backends/slideshare.coffee"
"src_client_manage/slide_backends/speakerdeck.coffee"
"src_client_manage/slide_backends/dummy.coffee"
"src_client_manage/video_backends/youtube.coffee"
"src_client_manage/video_backends/vimeo.coffee"
"src_client_manage/video_backends/dummy.coffee"
"src_client_manage/models/presentation_thumb.coffee"
"src_client_manage/models/presentation_thumb_list.coffee"
"src_client_manage/models/presentation.coffee"
"src_client_manage/views/utils.coffee"
"src_client_manage/views/presentation_thumb_view.coffee"
"src_client_manage/views/presentation_thumb_list_view.coffee"
"src_client_manage/views/presentation_new_view.coffee"
"src_client_manage/views/presentation_edit_view.coffee"
"src_client_manage/views/app_view.coffee"
"src_client_manage/views/navigation_view.coffee"
"src_client_manage/router.coffee"
"src_client_manage/main.coffee"
"src_client_manage/validation.coffee"
])
css_manage: new_css_conf("manage", [
"public/assets/css/jquery-ui-1.8.23.custom.css"
"public/assets/css/mediaelementplayer.css"
"public/assets/css/bootstrap.css"
"public/assets/css/bootstrap-responsive.css"
"public/assets/css/fluid_container.css"
"public/assets/css/movingboxes.css"
"public/assets/css/manage.css"
])
exports.assetsMiddleware = assetsMiddleware