UNPKG

closure-builder

Version:

Simple Closure, Soy and JavaScript Build system

124 lines (123 loc) 11.2 kB
Usage: java com.google.template.soy.SoyToJsSrcCompiler \ [<flag1> <flag2> ...] --outputPathFormat <formatString> \ --srcs <soyFilePath>,... [--deps <soyFilePath>,...] --allowExternalCalls : Whether to allow external calls. New projects should set this to false, and existing projects should remove existing external calls and then set this to false. It will save you a lot of headaches. Currently defaults to true for backward compatibility. --bidiGlobalDir N : The bidi global directionality (ltr=1, rtl=-1). Only applicable if your Soy code uses bidi functions/directives. Also note that this flag is usually not necessary if a message file is provided, because by default the bidi global directionality is simply inferred from the message file. --codeStyle [STRINGBUILDER | CONCAT] : The code style to use when generating JS code ('stringbuilde r' or 'concat'). --compileTimeGlobalsFile VAL : The path to a file containing the mappings for global names to be substituted at compile time. Each line of the file should have the format "<global_name> = <primitive_data>" where primitive_data is a valid Soy expression literal for a primitive type (null, boolean, integer, float, or string). Empty lines and lines beginning with "//" are ignored. The file should be encoded in UTF-8. If you need to generate a file in this format from Java, consider using the utility SoyUtils.generateCompileTimeGlobalsFile(). --cssHandlingScheme VAL : The scheme to use for handling 'css' commands. Specifying 'literal' will cause command text to be inserted as literal text. Specifying 'reference' will cause command text to be evaluated as a data or global reference. Specifying 'goog' will cause generation of calls goog.getCssName. This option has no effect if the Soy code does not contain 'css' commands. --deps ITEM,ITEM,... : The list of dependency Soy files (if applicable). The compiler needs deps for analysis/checking, but will not generate code for dep files. --googMsgsAreExternal : [Only applicable if --shouldGenerateGoogMsgDefs is true] If this option is true, then we generate "var MSG_EXTERNAL_<soy GeneratedMsgId> = goog.getMsg(...);". If this option is false, then we generate "var MSG_UNNAMED_<uniquefier> = goog.getMsg(...);". [Explanation of true value] Set this option to true if your project is having Closure Templates do message extraction (e.g. with SoyMsgExtractor) and then having the Closure Compiler do translated message insertion. [Explanation of false value] Set this option to false if your project is having the Closure Compiler do all of its localization, i.e. if you want the Closure Compiler to do both message extraction and translated message insertion. A significant drawback to this setup is that, if your templates are used from both JS and Java, you will end up with two separate and possibly different sets of translations for your messages. --indirectDeps ITEM,ITEM,... : Soy files required by deps, but which may not be used by srcs. --inputPrefix VAL : If provided, this path prefix will be prepended to each input file path listed on the command line. This is a literal string prefix, so you'll need to include a trailing slash if necessary. --isUsingIjData : Whether to enable use of injected data (syntax is '$ij.*'). --locales ITEM,ITEM,... : [Required for generating localized JS] Comma-delimited list of locales for which to generate localized JS. There will be one output JS file for each combination of input Soy file and locale. --messageFilePathFormat VAL : [Required for generating localized JS] A format string that specifies how to build the path to each translated messages file. The format string can include literal characters as well as the placeholders {INPUT_PREFIX}, {LOCALE}, and {LOCALE_LOWER_CASE}. Note {LOCALE_LOWER_CASE} also turns dash into underscore, e.g. pt-BR becomes pt_br. The format string must end with an extension matching the message file format (case-insensitive). --messagePluginModule VAL : Specifies the full class name of a Guice module that binds a SoyMsgPlugin. If not specified, the default is com.google.template.soy.xliffmsgplugin.XliffMsgPluginModule, which binds the XliffMsgPlugin. --outputPathFormat VAL : [Required] A format string that specifies how to build the path to each output file. If not generating localized JS, then there will be one output JS file (UTF-8) for each input Soy file. If generating localized JS, then there will be one output JS file for each combination of input Soy file and locale. The format string can include literal characters as well as the placeholders {INPUT_PREFIX}, {INPUT_DIRECTORY}, {INPUT_FILE_NAME}, {INPUT_FILE_NAME_NO_EX T}, {LOCALE}, {LOCALE_LOWER_CASE}. Note {LOCALE_LOWER_CASE} also turns dash into underscore, e.g. pt-BR becomes pt_br. --pluginModules VAL : Specifies the full class names of Guice modules for function plugins and print directive plugins (comma-delimite d list). --shouldDeclareTopLevelNamespaces : [Only applicable when generating regular JS code to define namespaces (i.e. not generating goog.provide/goog.require).] When this option is set to false, each generated JS file will not attempt to declare the top-level name in its namespace, instead assuming the top-level name is already declared in the global scope. E.g. for namespace aaa.bbb, the code will not attempt to declare aaa, but will still define aaa.bbb if it's not already defined. --shouldGenerateGoogMsgDefs : When this option is used, all 'msg' blocks will be turned into goog.getMsg definitions and corresponding usages. Must be used with either --bidiGlobalDir, or --useGoogIsRtlForBid iGlobalDir, usually the latter. Also see --googMsgsAreExtern al. --shouldGenerateJsdoc : Whether we should generate JSDoc with type info for the Closure Compiler. Note the generated JSDoc does not have description text, only types for the benefit of the Closure Compiler. --shouldProvideRequireSoyNamespaces : When this option is used, each generated JS file will contain (a) one single goog.provide statement for the corresponding Soy file's namespace and (b) goog.require statements for the namespaces of the called templates. --srcs ITEM,ITEM,... : [Required] The list of source Soy files. --supportContentSecurityPolicy : Adds attributes so that browsers that support the Content Security Policy (CSP) can distinguish inline scripts written by the template author from any injected via XSS. If true, the parameter {$ij.csp_nonce} should contain an unpredictable per-page-render secret consisting of ASCII alpha-numerics, plus (+), and solidus (/). Off by default. --syntaxVersion VAL : User-declared syntax version for the Soy file bundle (e.g. 2.0, 2.3). --useGoogIsRtlForBidiGlobalDir : [Only applicable if both --shouldGenerateGoogMsgDefs and --shouldProvideRequireSoyNamespaces is true] Whether to determine the bidi global direction at template runtime by evaluating goog.i18n.bidi.IS_RTL. Do not combine with --bidiGlobalDir.