forked from google/closure-templates
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
supporting code for issue google#221
- Loading branch information
Rob Figueiredo
committed
Dec 1, 2020
1 parent
6223fef
commit caaba74
Showing
3 changed files
with
50 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package main; | ||
|
||
import java.io.File; | ||
|
||
import com.google.inject.Guice; | ||
import com.google.inject.Injector; | ||
import com.google.template.soy.SoyFileSet; | ||
import com.google.template.soy.SoyModule; | ||
import com.google.template.soy.error.SoyCompilationException; | ||
import com.google.template.soy.error.SoyError; | ||
|
||
public class CompileSoy { | ||
public static void main(String[] args) throws Exception { | ||
Injector injector = Guice.createInjector(new SoyModule()); | ||
SoyFileSet.Builder fsBuilder = | ||
injector | ||
.getInstance(SoyFileSet.Builder.class) | ||
.setAllowExternalCalls(false) | ||
.add(new File(args[0])); | ||
try { | ||
fsBuilder.build().compileTemplates(); | ||
} catch (SoyCompilationException e) { | ||
for (SoyError err : e.getErrors()) { | ||
System.out.println(err); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{namespace main} | ||
|
||
{template .main} | ||
{@param appName: string} | ||
<link rel="stylesheet" | ||
type="text/css" | ||
href="/{$appName}/public/stylesheets/styles.css"> | ||
{/template} |