1.1.5 • Published 6 years ago

grunt-contrib-template v1.1.5

Weekly downloads
1
License
MIT
Repository
github
Last release
6 years ago

grunt-contrib-template

Combine JavaScript files based on a template.

Inspired by grunt-contrib-concat

Running a beautifier after the process is recommended

Installing

Install the package from npm

npm install grunt-contrib-template --save-dev

Enable the task in your gruntfile.js

grunt.loadNpmTasks('grunt-contrib-template');

Template task

Options

separator

Type: String

Default: ''

defaultExtension

Type String

Default '.js'

Setup

// Project configuration.
grunt.initConfig({
  template: {
    js: {
      template: "template.js",
      dest: "output.js",
      options: {
        separator: '',
        defaultExtension: '.js'
      }
    }
  },
});

Example

Folder structure

-- template.js
-- app
    |-- foo.js
    |-- bar.js

template.js

var example = function() {
	"<!= app/foo.js !>";
};

foo.js

console.log("This is foo.");
"<!= bar !>";

bar.js

console.log("This is bar.");

output.js

var example = function() {
	console.log("This is foo.");
	console.log("This is bar.");
};
1.1.5

6 years ago

1.1.4-1

8 years ago

1.1.4

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago

1.1.1

8 years ago

1.1.0

8 years ago

1.0.1-1

8 years ago

1.0.1

8 years ago

1.0.0-1

8 years ago

1.0.0

8 years ago