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

https://github.com/itsmunim/grunt-simple-concat

Replace referenced JS file paths with one single JS in your HTML
https://github.com/itsmunim/grunt-simple-concat

Last synced: over 1 year ago
JSON representation

Replace referenced JS file paths with one single JS in your HTML

Awesome Lists containing this project

README

          

## grunt-simple-concat

### How to use

#### Grunt Config

```
simpleConcat: {
main: {
src: 'app/index.html',
cwd: './', // working dir relative(or absolute) path,
scriptsDir: 'scripts', // directory in dest path that should contain script files; optional
dest: 'dist'
}
}
```

- Then just add `simple` tags with target name after `:` in your html. And enclose your script tags inside `simple` tags.

Example-

```

```

- If the task is run, this will generate a `vendor.js` file in specified `dest` folder and your html will have all these replaced with single `script` tag with path for `vendor.js`

#### Testing the Task

A sample task config and setup is added in `testing/` folder. Simply create an `index.html` with similar kind of content as `index.example.html` as given in `app` folder. Then run `npm i` to install the dependencies and finally run `grunt`

Don't forget to hit a star, if this saved your life by working in your legacy project!
Also, switch to `webpack` asap!