gulp-soynode
Gulp plugin using soynode for working with Closure Templates, aka Soy.
Issues with the output should be reported on the soynode issue tracker.
Install
$ npm install --save-dev gulp-soynode
Usage
var gulp = ;var soynode = ; gulp;
You can also watch for changes to rebuild all templates:
gulp;
Or, if you prefer, rebuild only one the modified file:
gulp;
Message extraction
You can also use gulp-soynode
to extract all messages from your soy templates into a tlf file, which can be used for translating them later. To use it, just call soynode.lang
with the name of the file you want the messages to be extracted to:
var gulp = ;var soynode = ; gulp;
Build with locales
var gulp = ;var soynode = ; gulp;
API
soynode(options)
Options can be set via soynode(options)
, the keys can contain the following:
renderSoyWeb
{boolean} Whether SoyWeb templates will be rendered automatically. It deliberately allows to includes dummy data so the designer can get a feel for how the task list will appear with real data rather with minimal copy and paste. For more information visit http://plovr.com/soyweb.html. [Default: false]renderSoyWebContext
{Object|function()} Default render context of rendered SoyWeb file, or a function that is called with each handled file, returning the context object for it. [Default: null]renderSoyWebFileExtension
{string} File extension of the rendered SoyWeb file. Relevant when your Soy template outputs other formats, like.md
. [Default: .html]renderSoyWebInjectedData
{Object|function()} Object with injected data to be used when rendering SoyWeb files, or a function that is called with each handled file, returning the injected data for it. [Default: null]inputDir
{string} Optional path to a directory where files will be read. When compiled from a directory, this option will be overwritten with the caller inputDir. [Default: process.cwd()]outputDir
{string} Path to a directory where files will be written. [Default: null]eraseTemporaryFiles
{boolean} Whether to erase temporary files after a compilation. [Default: false]concatOutput
{boolean} Whether the compiled soy.js files should be joined into a single file. This is helpful for loading templates in a browser and simplest to use whenoutputDir
is explicitly set anduniqueDir
is false. [Default: false]concatFileName
{string} File name used for concatenated files, only relevant when concatOutput is true, ".soy.concat.js" is appended, so don't include ".js" yourself. [Default: compiled]- locales {Array} List of locales to translate the templates to.
- messageFilePathFormat {string} Path to the translation file to use, which can contain any of the placeholders allowed on the --messageFilePathFormat option of SoyToJsSrcCompiler.jar.
See the soynode options for more information.
soynode.lang(options)
Options can be set via soynode.lang(options)
, the keys can contain the following:
outputFile
{String} The path of the file with the resulting extracted messages. [Default: '/tmp/soynode/translations.xlf']
Contributing
Questions, comments, bug reports, and pull requests are all welcome. Submit them at the project on GitHub.
Bug reports that include steps-to-reproduce (including code) are the best. Even better, make them in the form of pull requests.