forked from DavyJonesLocker/ember-easy-form
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Assetfile
executable file
·59 lines (48 loc) · 1.32 KB
/
Assetfile
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
require 'barber'
instance_eval File.read(EmberDev.support_path.join('Assetfile'))
class InlineHandlebarsPrecompiler < Rake::Pipeline::Filter
def precompile_templates(data)
data.gsub!(/Ember\.Handlebars\.compile\(['"](.*)['"]\)/) do
Barber::Ember::InlinePrecompiler.call($1)
end
end
def generate_output(inputs, output)
inputs.each do |input|
result = File.read(input.fullpath)
precompile_templates(result)
output.write result
end
end
end
distros = {
:full => %w(ember-easyForm)
}
output "dist"
distros.each do |name, modules|
name = "ember-easyForm"
input "dist/modules" do
module_paths = modules.map{|m| "#{m}.js" }
match "{#{module_paths.join(',')}}" do
concat(module_paths){ ["#{name}.js", "#{name}.prod.js"] }
end
match "#{name}.js" do
filter InlineHandlebarsPrecompiler
filter VersionInfo
filter EmberLicenseFilter
end
# Strip dev code
match "#{name}.prod.js" do
filter InlineHandlebarsPrecompiler
filter VersionInfo
filter EmberLicenseFilter
filter(EmberStripDebugMessagesFilter) { ["#{name}.prod.js", "min/#{name}.js"] }
end
# Minify
match "min/#{name}.js" do
uglify{ "#{name}.min.js" }
filter VersionInfo
filter EmberLicenseFilter
end
end
end
# vim: filetype=ruby