# grunt-index-html-template

> It replaces templated block in index.html with project javascripts as script tags so you don't need a manifest.

Latest version **0.2.5** (published 2014-01-22) · 0 weekly downloads

## Install

```sh
npm install grunt-index-html-template
pnpm add grunt-index-html-template
yarn add grunt-index-html-template
bun add grunt-index-html-template
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.5 |
| Published | 2014-01-22 |
| First published | 2014-01-22 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.8.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Joel Hooks |
| Maintainers | joelhooks |
| Keywords | gruntplugin |

## Links

- npm: https://www.npmjs.com/package/grunt-index-html-template
- Repository: https://github.com/joelhooks/grunt-index-html-template
- Issues: https://github.com/joelhooks/grunt-index-html-template/issues
- npm.io page: https://npm.io/package/grunt-index-html-template

## Recent versions

- 0.2.5 (latest) — 2014-01-22
- 0.2.4 — 2014-01-22
- 0.2.3 — 2014-01-22

## README

This will take a templated index.html and add a list of JS files as script tags.

```
<!DOCTYPE html>
<html ng-app="example-app">
<head>
  <title>AngularJS Example</title>
</head>
<body>

<div ui-view></div>

<% scripts.forEach( function ( file ) { %>
<script type="text/javascript" src="<%= file %>"></script>
<% }); %>

</body>
</html>
```

becomes:

```
<!DOCTYPE html>
<html ng-app="example-app">
<head>
  <title>AngularJS Example</title>
</head>
<body>

<div ui-view></div>


<script type="text/javascript" src="vendor/angular/angular.js"></script>

<script type="text/javascript" src="vendor/angular-ui-router/release/angular-ui-router.js"></script>

<script type="text/javascript" src="src/app/app.js"></script>

<script type="text/javascript" src="src/app/login/login.js"></script>

<script type="text/javascript" src="templates-app.js"></script>


</body>
</html>
```

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 %>'
        ]
      }
    }
```

---
_Source: https://npm.io/package/grunt-index-html-template · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
