Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I tell Grunt to NOT minify or concatenate js files in a build task?

I've just scaffolded an Angular app using Yeoman. I've noticed that the build task does several things by default, including minifying and concatenating js files.

I'd like to have a simpler build task that didn't do any minifying or concatenation, and, instead, only did the following two things:

  1. compile my .scss into .css
  2. copy a working app into my distribution directory

Can anyone help me write a grunt task that will do (only) these two things?

Many thanks.

like image 745
dB' Avatar asked Dec 17 '13 19:12

dB'


1 Answers

Ok, I've edited the default grunt file so that it does what I want.

My solution involved writing tasks called copy:devDist and compass:devDist, and then combining them into a devDist task.

//
//  copy:devDist --> copies everything into the dist folder, except styles/
//
    copy: {
      [...]
      devDist: {         
        files: [{
          expand: true,
          dot: true,
          cwd: '<%= yeoman.app %>',
          dest: '<%= yeoman.dist %>',
          src: [
            '**','!styles/**'   // everything but styles/
          ]
        }]
      }
    },



//
//  compass:devDist --> compile the sass; put result in dist/styles/
//
    compass: {
      [...]
      devDist: {
        options: {
          cssDir: '<%= yeoman.dist %>/styles'  
        }
      }
    },




  //
  // register a 'devDist' task that calls the two tasks above
  //
  grunt.registerTask('devDist', [
    'clean:dist',
    'copy:devDist',
    'compass:devDist'
  ]);

Now running grunt devDist compiles my css and puts a fully functional app into my dist folder. Excellent. :)

like image 175
dB' Avatar answered Oct 14 '22 17:10

dB'