public final class SoyFileSet extends Object
Note: Soy file (or resource) contents must be encoded in UTF-8.
| Modifier and Type | Class and Description |
|---|---|
static class |
SoyFileSet.Builder
Builder for a
SoyFileSet. |
| Modifier and Type | Method and Description |
|---|---|
static SoyFileSet.Builder |
builder()
Creates a builder with the standard set of Soy directives, functions, and types.
|
SoySauce |
compileTemplates()
Compiles this Soy file set into a set of java classes implementing the
SoySauce
interface. |
List<String> |
compileToIncrementalDomSrc(SoyIncrementalDomSrcOptions jsSrcOptions)
Compiles this Soy file set into iDOM source code files and returns these JS files as a list of
strings, one per file.
|
List<String> |
compileToJsSrc(SoyJsSrcOptions jsSrcOptions,
SoyMsgBundle msgBundle)
Compiles this Soy file set into JS source code files and returns these JS files as a list of
strings, one per file.
|
SoyTofu |
compileToTofu()
Compiles this Soy file set into a Java object (type
SoyTofu) capable of rendering the
compiled templates. |
void |
extractAndWriteMsgs(SoyMsgBundleHandler msgBundleHandler,
SoyMsgBundleHandler.OutputFileOptions options,
com.google.common.io.ByteSink output)
Extracts all messages from this Soy file set and writes the messages to an output sink.
|
SoyMsgBundle |
extractMsgs()
Extracts all messages from this Soy file set into a SoyMsgBundle (which can then be turned into
an extracted messages file with the help of a SoyMsgBundleHandler).
|
SoyMsgBundle |
pruneTranslatedMsgs(SoyMsgBundle origTransMsgBundle)
Prunes messages from a given message bundle, keeping only messages used in this Soy file set.
|
public static SoyFileSet.Builder builder()
If you need additional directives, functions, or types, create the Builder instance using Guice. If your project doesn't otherwise use Guice, you can just use Guice.createInjector with only the modules you need, similar to the implementation of this method.
public SoyMsgBundle extractMsgs()
SoyCompilationException - If compilation fails.public void extractAndWriteMsgs(SoyMsgBundleHandler msgBundleHandler, SoyMsgBundleHandler.OutputFileOptions options, com.google.common.io.ByteSink output) throws IOException
msgBundleHandler - Handler to write the messages.options - Options to configure how to write the extracted messages.output - Where to write the extracted messages.IOException - If there are errors writing to the output.public SoyMsgBundle pruneTranslatedMsgs(SoyMsgBundle origTransMsgBundle)
Important: Do not use directly. This is subject to change and your code will break.
Note: This method memoizes intermediate results to improve efficiency in the case that it is called multiple times (which is a common case). Thus, this method will not work correctly if the underlying Soy files are modified between calls to this method.
origTransMsgBundle - The message bundle to prune.SoyCompilationException - If compilation fails.public SoyTofu compileToTofu()
SoyTofu) capable of rendering the
compiled templates.SoyTofu object.SoyCompilationException - If compilation fails.public SoySauce compileTemplates()
SoySauce
interface.
This is useful for implementing 'edit refresh' workflows. Most production usecases should
use the command line interface to 'ahead of time' compile templates to jar files and then use
PrecompiledSoyModule to get access to a SoySauce object without invoking the
compiler. This will allow applications to avoid invoking the soy compiler at runtime which can
be relatively slow.
SoyCompilationException - If compilation fails.public List<String> compileToJsSrc(SoyJsSrcOptions jsSrcOptions, @Nullable SoyMsgBundle msgBundle)
jsSrcOptions - The compilation options for the JS Src output target.msgBundle - The bundle of translated messages, or null to use the messages from the Soy
source.SoyCompilationException - If compilation fails.public List<String> compileToIncrementalDomSrc(SoyIncrementalDomSrcOptions jsSrcOptions)
jsSrcOptions - The compilation options for the JS Src output target.SoyCompilationException - If compilation fails.