Skip to content

mknichel/closure-templates-bazel

Folders and files

NameName
Last commit message
Last commit date

Latest commit

5141411 · Jul 27, 2015

History

4 Commits
Jul 27, 2015
Jul 27, 2015
Jul 27, 2015
Jul 27, 2015
Jul 26, 2015
Jul 26, 2015
Jul 27, 2015
Jul 27, 2015

Repository files navigation

closure-templates-bazel

Overview

This project provides an extension to Bazel to compile Google Closure Templates files into JavaScript files.

Usage

This extension is used in existing BUILD files in your project. For directories that contain .soy files, add the following rule:

load("//path/to/closure_templates", "soy_library")

soy_library(
    name = 'my_soy_library',
    srcs = glob(["*.soy"]),
)

In a terminal, then run the command:

bazel build //path/to/src:my_soy_library

This will generate a .soy.js file for every Soy source file in that directory.

Setting up a project to use this Bazel extension

  1. Set up Bazel by following the instructions on the Getting Started page
  2. Put a copy of the SoyToJsSrcCompiler.jar in a tools/ directory in your project.
  3. Put the closure_templates.bzl file somewhere in your project. Every BUILD file that uses Soy will need to load this .bzl file at that path.
  4. Follow Usage instructions.

Running the demo in this project

To test out this extension using this project, follow these instructions:

  1. Run git clone https://github.com/mknichel/closure-templates-bazel.git
  2. Set up Bazel by following the instructions on the Getting Started page
  3. Run bazel build //demo:demo_soy
  4. Examine the output in bazel-genfiles/demo/demo.soy.js

About

Bazel integration for Closure Templates

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages