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
|
# File 'lib/antoinette/cli/commands.rb', line 68
def call(**)
out = Antoinette::CLI.output
config_path = Rails.root.join("config", "antoinette.json")
config = JSON.parse(File.read(config_path))
elm_path = config["elm_path"] || "elm"
compiler = Antoinette::CompileElm.new(elm_path: elm_path)
concatenator = Antoinette::ConcatBundle.new
injector = Antoinette::InjectScriptTag.new
config["bundles"].each do |bundle|
out.puts "Building bundle: #{bundle["name"]}"
elm_js = compiler.compile(bundle["elm_apps"])
concatenator.concatenate(
bundle_name: bundle["name"],
elm_js: elm_js
)
bundle["templates"].each do |template_path|
injector.inject(template_path: template_path, bundle_name: bundle["name"])
end
out.puts " Compiled Elm apps: #{bundle["elm_apps"].join(", ")}"
out.puts " Injected script tags into #{bundle["templates"].length} template(s)"
end
out.puts "Build complete!"
end
|