grunt-broccoli

Broccoli build and serve tasks for Grunt task runner

grunt-broccoli

Allows you to execute your Broccoli configurations as Grunt tasks. Broccoli is an asset pipeline that allows for incremental builds. Broccoli rebuilds individual files instead of the entire project as Grunt watch does. Checkout the Broccoli Sample App.

grunt-broccoli is a multi-task so you must specify a target when running the task.

grunt broccoli:{targetName}:build
grunt broccoli:{targetName}:watch
grunt broccoli:{targetName}:serve

You can configure these settings (see examples below):

config: [String or Function] If a string, it refers to the location of the Brocfile relative to the current working directory. If a function, it expects that the return value is a Broccoli-compatible tree. Defaults to 'Brocfile.js'.

dest: [String] Specifies the output folder. This doesn't affect the serve command. The build and watch commands will abort if a dest directory is not set.

host/port: [String]/[Number] Specifies the host and port that the Broccoli server runs on. This only affects the serve command. Defaults to localhost and 4200.

env: [String] Set the BROCCOLI_ENV to use (see broccoli-env).

broccoli: {
  dist: {
    dest: 'dist',
    configfunction() {
      var transpiled = transpileTree('lib');
      var allFiles = mergeTrees([transpiled, 'vendor']);
      var concated = concatFiles(allFiles);
      var uglified = uglifyFiles(concated);
      return uglified;
    }
  },
 
  dev: {
    dest: 'tmp/tests',
    config: 'brocfiles/development.js',
    port: 4201
  }
}