Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Ok, so stumbled on the answer while looking for something else and since no one had yet responded. Here is how I solved it:</p> <p>You get a copy of <strong><a href="https://github.com/jsoverson/grunt-preprocess#getting-started" rel="noreferrer">Grunt Preprocess</a></strong> with</p> <pre><code>npm install --save-dev grunt-preprocess </code></pre> <p>Then you modify your <code>GruntFile.js</code> like so (this is for an angular project, YMMV)</p> <pre><code>module.exports = function (grunt) { grunt.loadNpmTasks('grunt-preprocess'); &lt;-- Add this line near the top of the file </code></pre> <p>add this in your list of subtasks</p> <pre><code> preprocess : { options: { inline: true, context : { DEBUG: false } }, html : { src : [ '&lt;%= yeoman.dist %&gt;/index.html', '&lt;%= yeoman.dist %&gt;/views/*.html' ] }, js : { src: '.tmp/concat/scripts/*.js' } }, </code></pre> <p>Modify your registered tasks (at the bottom of the file) like thils:</p> <pre><code>grunt.registerTask('build', [ 'clean:dist', 'useminPrepare', 'concurrent:dist', 'autoprefixer', 'concat', 'preprocess:js', // Remove DEBUG code from production builds 'preprocess:html', // Remove DEBUG code from production builds 'ngmin', 'copy:dist', 'cdnify', 'cssmin', 'uglify', 'rev', 'usemin' ]); </code></pre> <p>Then modify your existing javascript code something like this:</p> <pre><code>// @if DEBUG 'server_mocks', // Won't be included in production builds // @endif </code></pre> <p>and your existing html code something like this:</p> <pre><code>&lt;!-- @if DEBUG --&gt; &lt;script src='scripts/mock.js'&gt;&lt;/script&gt; &lt;!-- Won't be included in production builds --&gt; &lt;!-- @endif --&gt; </code></pre>
    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.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      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