Skip to content
This repository has been archived by the owner on Apr 24, 2019. It is now read-only.

Commit

Permalink
Add config option to add custom concat tasks (#87)
Browse files Browse the repository at this point in the history
This also includes docs, using xtend for concat.
  • Loading branch information
anselmh committed Mar 25, 2014
1 parent cd96376 commit 3f20e3e
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
### HEAD

* Use load-grunt-tasks instead of matchdep
* Add config option to add custom concat tasks (#87)
* Clean up Karma configuration and make coverage working with new version
* Add `grunt/tasks` folder for own tasks
* Add directory `grunt/plugins` to include plugins for Grunt config
Expand Down
1 change: 1 addition & 0 deletions docs/TOC.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
* [JavaScript](js.md) — A guide to the default JavaScript with RequireJS.
* [Build process](grunt.md) - A detailed guide to the GruntJS configs.
* [Testing](tests.md) — How to test your code with INIT.
* [Custom File Concatenation](concat.md) — How to concatenate your files with INIT.
* [Some other things](misc.md).

## Extend INIT
Expand Down
29 changes: 29 additions & 0 deletions docs/concat.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
[« back to Table of Contents](TOC.md)

# Concatenate files with INIT

INIT supports concatenation out of the box through
[`grunt-contrib-concat`](https://github.com/gruntjs/grunt-contrib-concat).
This is used by default for concatenating your template partials into a working
prototype / HTML page.

## Add custom concat tasks

You can add custom tasks to concatenate files. Add your custom concatenations to
the config object in `config.js`.

A sample custom config object could look like:

concat: {
concatFirst: {
src: [
'js/part1.js',
'js/part2.js'
],
dest: 'concatenatedfile.js'
}
},

The `src` key references your partials that you want to concatenate. The `dest`
key describes the relative path to the result. The path is set relative from
INIT’s root.
4 changes: 3 additions & 1 deletion grunt/options/concat.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
*/
'use strict';

var xtend = require('xtend');
var pages = require('../../pages');
var config = require('../config');

module.exports = pages;
module.exports = xtend(pages, config.concat || {});

0 comments on commit 3f20e3e

Please sign in to comment.