https://github.com/joelhooks/grunt-index-html-template
Keeps script tag manifest up to date in index.html
https://github.com/joelhooks/grunt-index-html-template
Last synced: 8 months ago
JSON representation
Keeps script tag manifest up to date in index.html
- Host: GitHub
- URL: https://github.com/joelhooks/grunt-index-html-template
- Owner: joelhooks
- License: mit
- Created: 2014-01-22T00:43:43.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2016-02-21T02:15:49.000Z (almost 10 years ago)
- Last Synced: 2025-04-04T11:07:45.661Z (9 months ago)
- Language: JavaScript
- Size: 129 KB
- Stars: 2
- Watchers: 1
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE-MIT
Awesome Lists containing this project
README
This will take a templated index.html and add a list of JS files as script tags.
```
AngularJS Example
<% scripts.forEach( function ( file ) { %>
<% }); %>
```
becomes:
```
AngularJS Example
```
YOu configure it like this:
```
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-index-html-template');
var taskConfig = {
index: {
build: {
dir: '<%= build_dir %>',
src: [
'<%= vendor_files.js %>',
'<%= build_dir %>/src/**/*.js',
'<%= html2js.app.dest %>'
]
}
}
};
};
```
It assumes that the index is in 'src/index.html' and will target index.html in dir. This can be overridden with some options:
```
index: {
options: {
src: 'src-other-src/index.html',
target: 'alt-index.html'
},
build: {
dir: '<%= build_dir %>',
src: [
'<%= vendor_files.js %>',
'<%= build_dir %>/src/**/*.js',
'<%= html2js.app.dest %>'
]
}
}
```