grunt-stitch-js

1.0.2 • Public • Published

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:

/*# 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:

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:

npm install grunt-stitch-js --save-dev

Load the task in your Gruntfile.js:

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

Note: NPM registry page for this plugin can be found here.

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.

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 guide, if you haven't used Grunt before and need help.

License

Licensed under MIT. See LICENSE.md file for details.

Bitdeli Badge

Readme

Keywords

none

Package Sidebar

Install

npm i grunt-stitch-js

Weekly Downloads

0

Version

1.0.2

License

none

Last publish

Collaborators

  • janhancic