Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you are trying to remove lines of Javascript using the h5bp default Google Closure Compiler I suggest looking at @define JSDoc Tag</p> <pre><code>/** @define {boolean} */ var DEBUG = true; </code></pre> <p>Then, in your project.properties file look for: <code># Closure Compiler Options</code> and set: <code>tool.closure.opts = --define DEBUG=false</code></p> <p>Finally, wrap any code you want ignored, in production, in a conditional: </p> <pre><code>if (!DEBUG) { console.log("Starting test"); console.log("Test 2"); } </code></pre> <p>The @define JSDoc Tag will help with your second question also.</p> <pre><code>/** * @define {string} */ var AJAX_URL = 'http://localhost/'; console.log(AJAX_URL); </code></pre> <p>with the compilations options: <code>--compilation_level ADVANCED_OPTIMIZATIONS --define AJAX_URL=\'http://example.com/\'</code> (Note: you made need to fiddle with the quote escaping, depending on your platform) the resulting code is:</p> <pre><code>console.log("http://example.com/"); </code></pre> <p>There are many ways to go about this of course, see:</p> <ul> <li><a href="http://paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/" rel="nofollow">http://paulirish.com/2009/log-a-lightweight-wrapper-for-consolelog/</a> </li> <li><a href="http://dailyjs.com/2012/02/02/console/" rel="nofollow">http://dailyjs.com/2012/02/02/console/</a></li> <li><a href="https://developers.google.com/closure/compiler/docs/js-for-compiler?hl=en" rel="nofollow">https://developers.google.com/closure/compiler/docs/js-for-compiler?hl=en</a></li> </ul>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload