Permalink
Switch branches/tags
Nothing to show
Find file
Fetching contributors…
Cannot retrieve contributors at this time
50 lines (47 sloc) 1.12 KB
<%
# options
options = {
'build' => 'raw',
'ns' => 'app.App'
}
query_string.split('/').each do |item|
item = item.split(':')
options[item[0]] = item[1]
end if query_string.length
# closure templates
goog.soy_to_js %w{
--cssHandlingScheme goog
--shouldGenerateJsdoc
--shouldProvideRequireSoyNamespaces
--outputPathFormat {INPUT_DIRECTORY}{INPUT_FILE_NAME}.js
**/*.soy
}
# closure compiler
args = %w{
--summary_detail_level 3 --ns
}
args << options['ns']
# production and debug only
unless options['build'] == 'raw'
compiled = %w{
--compilation_level ADVANCED_OPTIMIZATIONS
--warning_level VERBOSE
--language_in ECMASCRIPT5_STRICT
}
# ensure externs are included
compiled += Dir.glob( expand_path('../externs/*.externs.js') ).map { |x| ['--externs',x] }
compiled.flatten!
end
args += case options['build']
when 'production' then compiled + %w{
--js_output_file ../public/js/app.js
--create_source_map ../public/js/app.map
}
when 'debug' then compiled + %w{
--js_output_file ../public/js/app.debug.js
--debug true
--formatting PRETTY_PRINT
}
else;[];end
@response = goog.compile(args).to_response
%>