Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>If you've got time to migrate from Chirpy to Grunt, you surely have time to try a couple of different minifiers and check for one which <em>doesn't</em> break your <code>forms.js</code> module.</p> <p>What you're doing is just fine, but I would argue in favor of using just uglify for everything. In my case, I copy all the scripts to a build folder, and then just run uglify on them.</p> <p>I configured uglify like this.</p> <pre><code>uglify: { js: { files: { 'bin/public/js/all.js': 'bin/public/js/**/*.js' }, options: { preserveComments: false } } } </code></pre> <p>You can <a href="https://github.com/bevacqua/unbox" rel="noreferrer">check out the repo on GitHub</a>, it might give you a couple of ideas.</p> <p>You can determine the ordering simply by being explicit about it when you define the files in your <code>uglify</code> target.</p> <pre><code>uglify: { js: { files: { 'bin/public/js/all.js': [ 'bin/public/js/IMPORTANT/**/*.js', 'bin/public/js/something.js', 'bin/public/js/else.js', 'bin/public/js/unimportant/*.js', // you can even exclude stuff 'bin/public/js/do-not-minify/**/*.js' ] } } } </code></pre> <p>You can check <a href="http://gruntjs.com/configuring-tasks#globbing-patterns" rel="noreferrer">Grunt file globbing patterns</a> for more info.</p> <h1>Update</h1> <p>The order in which your files are described in the globbing pattern is the order in which they'll be processed, this is true for almost all tasks that take a glob in Grunt. If you can't uglify everything, I'm guessing you'll still want to concatenate. In that case, I'd advise you have a flow like the following pseudo-code, to get you going:</p> <pre><code>uglify: { js: { files: { 'bin/public/js/all.js': [ // using whichever order of importance you need 'src/public/js/**/*.js', '!the-ones-you-dont-minify' ] } }, concat: { // using whichever order of importance you need 'src/the-ones-you-dont-minify/**/*.js', '!the-ones-you-minified' } grunt.registerTask('build', ['clean', 'uglify:js', 'concat']); </code></pre>
    singulars
    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.
 

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