Add support for JS templates to the GUI
authorThomas Genin <tgenin@expensify.com>
Fri, 1 Aug 2014 06:46:19 +0000 (23:46 -0700)
committerThomas Genin <tgenin@expensify.com>
Sun, 3 Aug 2014 19:22:07 +0000 (12:22 -0700)
Add UI for JS templates

Remove useless code

restore minify script

assets/master.css
assets/master.js
index.html

index ceb4be7..1c3979e 100644 (file)
@@ -12,6 +12,7 @@ button { font-weight: bold; width: 100px; }
 #options ul li { float: left; clear: both; padding-bottom: 0.5em; }
 #options ul li div { margin-left: 1.75em; }
 #options label, #options input { float: left; }
+#options label.sub-option{ margin-left: 22px; margin-right: 5px }
 #options input { margin-right: 0.5em; }
 #stats { margin-bottom: 2em; overflow: hidden; margin-top: 0; }
 #todo { font-family: monospace; margin-bottom: 2em; }
index 985329d..48c2f3b 100644 (file)
@@ -30,6 +30,7 @@
       caseSensitive:                  byId('case-sensitive').checked,
       keepClosingSlash:               byId('keep-closing-slash').checked,
       minifyJS:                       byId('minify-js').checked,
+      processScripts:                 byId('minify-js-templates').checked ? byId('minify-js-templates-type').value : false,
       minifyCSS:                      byId('minify-css').checked,
       lint:                           byId('use-htmllint').checked ? new HTMLLint() : null,
       maxLineLength:                  parseInt(byId('max-line-length').value, 10)
@@ -96,6 +97,7 @@
     var inputEls = byId('options').getElementsByTagName('input');
     inputEls[10].checked = false;
     inputEls[11].checked = false;
+    inputEls[18].checked = false;
     return false;
   };
 
index 693ece3..fbeee0e 100644 (file)
                 Minify JS
               </label>
             </li>
+            <li>
+              <input type="checkbox" id="minify-js-templates">
+              <label for="minify-js-templates">
+                Minify JS Templates
+                <br>
+                <span class="quiet short">
+                  Minify HTML served inside script tag with a custom type attribute like "text/x-handlebars-template"
+                </span>
+              </label>
+            </li>
+            <li>
+              <label for="minify-js-templates-type" class="sub-option">
+                Template type
+              </label>
+              <input type="input" id="minify-js-templates-type">
+            </li>
             <li>
               <input type="checkbox" id="minify-css" checked>
               <label for="minify-css">
               </label>
             </li>
             <li>
-              <label for="max-line-length" style="margin-left: 22px; margin-right: 5px">
+              <label for="max-line-length" class="sub-option">
                 Max line length
               </label>
               <input type="number" id="max-line-length" value="0" min="0" max="10000">