Grunt wrapper for client-compiler.
Switch branches/tags
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Grunt wrapper for client-compiler.

Build Status

Getting Started

This plugin requires Grunt ~0.4.0

If you haven't used Grunt before, be sure to check out the Getting Started guide, as it explains how to create a Gruntfile as well as install and use Grunt plugins. Once you're familiar with that process, you may install this plugin with this command:

npm install grunt-client-compiler --save-dev

One the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:


The "client_compiler" task


In your project's Gruntfile, add a section named client_compiler to the data object passed into grunt.initConfig().

  client_compiler: {
    options: {
      // Task-specific options go here.
    your_target: {
      // Target-specific file lists and/or options go here.

The name of each target is used as the output name. E.g.: If you define a target named test, it will create a bundle named test.bundle.min.js.



Type: String Default value: 'src'

Path (relative to the location of the Gruntfile) where source files can be found.


Type: Array Default value: []

Array of library file names. Do not include the .js suffix. Example:



Type: Boolean Default value: false

Whether or not to output progress messages.


Type: Function(verb, message) Default value: null

A custom logging function. Takes two arguments:

  • verb: A keyword that identifies the action.
  • message: The full message details.


Type: String Default value: 'lib/js'

Path (relative to the location of the Gruntfile) where libraries can be found.


Type: String Default value: 'public/js'

Path (relative to the location of the Gruntfile) where generated bundles should be placed.


Type: String Default value: 'tmp/js'

Path (relative to the location of the Gruntfile) where temporary files should be written.


Type: String Default value: ''

Prepend this value to the filenames. Set this if you have multiple bundles with clashing filenames.


Type: String Default value: undefined

Require this file automatically when loading the bundle.


Type: Boolean Default value: false

When set, the implementation of require will be omitted from the generated bundle. Use this if you plan to include multiple bundles on one page. Only the first one needs to carry an implementation of require.

Usage Examples

Default Options

In this example, we simply compile a bundle named app.bundle.min.js, with all options set to their defaults.

    client_compiler: {
        test: {} 

Custom Options

You can override options by setting them in the options object.

    client_compiler: {
        test: {
            options: {
                pack: ['jquery']

Multiple targets

Define multiple targets if you want to compile multiple bundles. Be sure to only include the header for the first bundle.

    client_compiler: {
        // Global options are shared between all targets.
        options: {
            outPath: 'out'

        core: {
            options: {
                pack: ['jquery']

        module: {
            options: {
                path: 'module-src',
                skipHeader: true

Not how you can share options among targets by specifying them globally.

The "client_compiler_bundle" task

This task does the same as the client_compiler task, yet does not minify the code (and will thus be a lot faster).

Accepts the same options.

The "client_compiler_min" task

Only performs the minification phase. Assumse that you have ran client_compiler_bundle before.


In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using Grunt.