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
- Host: GitHub
- URL: https://github.com/itsmunim/grunt-simple-concat
- Owner: itsmunim
- License: mit
- Created: 2019-08-29T17:25:28.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2022-07-20T16:02:52.000Z (about 4 years ago)
- Last Synced: 2025-02-23T04:04:40.826Z (over 1 year ago)
- Language: JavaScript
- Size: 92.8 KB
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: ReadMe.md
- License: LICENSE-MIT
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!