diff --git a/.eslintrc b/.eslintrc
index 39172a499..59d17b1e9 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -27,6 +27,7 @@
"Promise": true,
"require": true,
"wcEvents": true,
+ "wcTmpl": true,
"WindowHelpers": true
},
"rules": {
diff --git a/.gitignore b/.gitignore
index 3c6671352..7266f789c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -25,6 +25,7 @@ webcompat/static/js/issues.js
webcompat/static/js/issue-list.js
webcompat/static/js/user-activity.js
webcompat/static/js/cssfixme.js
+webcompat/static/js/templates.js
webcompat/**/*.min.js
webcompat/**/*.min.css
webcompat/**/*.dev.css
diff --git a/Gruntfile.js b/Gruntfile.js
index 508d95d29..8641f2b07 100644
--- a/Gruntfile.js
+++ b/Gruntfile.js
@@ -5,6 +5,7 @@
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON("package.json"),
+ tmplPath: "webcompat/templates/",
jsPath: "webcompat/static/js",
cssPath: "webcompat/static/css",
imgPath: "webcompat/static/img",
@@ -24,6 +25,7 @@ module.exports = function(grunt) {
// Default task.
grunt.registerTask("default", [
"checkDependencies",
+ "jst",
"concat",
"uglify",
"postcss",
@@ -33,6 +35,7 @@ module.exports = function(grunt) {
// Task used before doing a deploy (same as default, but does image optimization)
grunt.registerTask("deploy", [
"checkDependencies",
+ "jst",
"concat",
"uglify",
"postcss",
diff --git a/docs/dev-env-setup.md b/docs/dev-env-setup.md
index 0f4549057..66fbee70e 100644
--- a/docs/dev-env-setup.md
+++ b/docs/dev-env-setup.md
@@ -198,6 +198,7 @@ After certain kinds of changes are made, you need to build the project before se
* CSS: a build will run cssnext, combine custom media queries, and concat all source files into webcompat.dev.css. You'll need to re-build the CSS to see any changes, so it's recommended to use a watch task (see `npm run watch`).
* JS: a build will run eslint, minify and concat source files.
+* JS templates (.jst files): if you are making changes to a Backbone template in a `.jst` file, you will need to re-run the `build` command to update the pre-compiled `templates.js` file before you will see the results.
* HTML templates: the changes should be served from disk without the need for rebuilding
* Python: the Flask local server will detect changes and restart automatically. No need to re-build.
diff --git a/grunt-tasks/concat.js b/grunt-tasks/concat.js
index cc3827dac..ca622612e 100644
--- a/grunt-tasks/concat.js
+++ b/grunt-tasks/concat.js
@@ -22,7 +22,8 @@ module.exports = function(grunt) {
"<%= jsPath %>/vendor/backbone.mousetrap.js",
"<%= jsPath %>/lib/flash-message.js",
"<%= jsPath %>/lib/homepage.js",
- "<%= jsPath %>/lib/bugform.js"
+ "<%= jsPath %>/lib/bugform.js",
+ "<%= jsPath %>/templates.js"
],
dest: "<%= jsPath %>/<%= pkg.name %>.js"
},
diff --git a/grunt-tasks/jst.js b/grunt-tasks/jst.js
new file mode 100644
index 000000000..5c6087e57
--- /dev/null
+++ b/grunt-tasks/jst.js
@@ -0,0 +1,30 @@
+/* This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
+
+module.exports = function(grunt) {
+ grunt.config("jst", {
+ compile: {
+ options: {
+ namespace: "wcTmpl",
+ prettify: true,
+ processContent: function(src) {
+ // strip the opening and closing
-
+ {% include "web_modules/issue-list.jst" %}
+