This simple SBT plugin generates a single JavaScript or HTML file to package up individual Angular templates. Templates are loaded into Angular using the $templateCache. Each individual template file must contain a single top-level element.
Add this to your project/plugins.sbt:
addSbtPlugin("org.databrary" % "sbt-angular-templates" % "0.2")You also must enable sbt-web plugins for your main project using .enablePlugins(SbtWeb).
You can control how the templates are generated using settings under AngularTemplatesKeys. The main ones are:
outputJs: File to generate containing loadable JavaScript templates, which can be directly sourced and loads all templates into the template cache, orNoneto disable generation. Defaults totemplates.js. To use this you must also setmodulecorrectly.outputHtml: File to generate containing includable HTML templates, embedded in<script> text/ng-templatetags, orNoneto disable generation. Defaults totemplates.html.compress: Compress HTML using HtmlCompressor. Most of the options listed there (such asRemoveIntertagSpaces) have equivalent settings here (compressRemoveIntertagSpaces).module: Name of angular application module variable. Defaults to "module".naming: Function to use to map each template source file path to its template id.sbt.Keys.includeFilter: Which source templates to include. Defaults to all .html files under assets.