Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/janhancic/grunt-stitch-js

A grunt task that can stitch together multiple files into one based on the provided template.
https://github.com/janhancic/grunt-stitch-js

Last synced: 22 days ago
JSON representation

A grunt task that can stitch together multiple files into one based on the provided template.

Awesome Lists containing this project

README

        

# grunt-stitch-js

A grunt task that can stitch together multiple files into one based on the provided template.

## What does it do?
This grunt task will automatically join multiple files into one file in the order you have defined in your stitch template file.

A stitch template file could look something like this:

```javascript
/*# src.js #*/

/* you can put arbitrary JavaScript code wherever in this file */

/*# some_file.js */
```

If we then had the files `src.js` and `some_file.js` and ran the `stitch` task, we would get a new file that would look something like this:

```javascript
contents of src.js file

/* you can put arbitrary JavaScript code wherever in this file */

contents of some_file.js file
```

## Installation
Install the plugin with `npm`:

```shell
npm install grunt-stitch-js --save-dev
```
Load the task in your `Gruntfile.js`:

```javascript
grunt.loadNpmTasks('grunt-stitch-js');
```

_Note_: NPM registry page for this plugin can be found [here](https://npmjs.org/package/grunt-stitch-js).

## Configuration
In order for the task to work it needs to know about two files:
- `templateFile`: the file to use as the template
- `out`: the file to write the result to

To configure the task put this into your `Gruntfile.js`.

```javascript
grunt.initConfig( {
'stitch-js': {
all: {
templateFile: 'path/to/template.js',
out: 'path/to/out.js'
}
}
} );
```

_Note_: you can have multiple targets (invoked with `grunt stitch-js:target_name`). `all` is one such target.

Please referrer to the Grunt [Getting Started](http://gruntjs.com/getting-started) guide, if you haven't used Grunt before and need help.

## License
Licensed under MIT. See [LICENSE.md](https://github.com/janhancic/grunt-stitch-js/blob/master/LICENSE.md) file for details.

[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/janhancic/grunt-stitch-js/trend.png)](https://bitdeli.com/free "Bitdeli Badge")