<% # Closure Compiler is run from a Script. To obtain # the dynamically generated javascript from this file: # http://localhost:8080/hello/compiler.js # These are the same options as compiler.jar. Two exceptions: # 1. No --compilation_level will load the original sources # instead of using the compiler.jar default. # 2. The --ns argument compiles a namespace. Closure Script simply # turns these into --js arguments before calling the compiler. args = %w{ --summary_detail_level 3 --ns myapp.hello } # You can make as many compiler Scripts as you like but # it may be more convenient to accept options on the URL. # http://localhost:8080/hello/compiler.js?build # http://localhost:8080/hello/compiler.js?debug args += case query_string when 'build' then %w{ --compilation_level ADVANCED_OPTIMIZATIONS --js_output_file compiler_build.js --create_source_map compiler_build.map } when 'debug' then %w{ --debug true --formatting PRETTY_PRINT --compilation_level ADVANCED_OPTIMIZATIONS --js_output_file compiler_debug.js } else;[];end # This will process all .soy files into .js files. # Be careful you don't make a file.soy to go with the # file.js you just started, it will overwrite file.js. # Touching any .soy file will trigger a recompile. goog.soy_to_js %w{ --cssHandlingScheme goog --shouldGenerateJsdoc --shouldProvideRequireSoyNamespaces --outputPathFormat {INPUT_DIRECTORY}{INPUT_FILE_NAME_NO_EXT}.js **/*.soy } # Compile the javascript. @response = goog.compile(args).to_response %>