Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hughsk/script-injector-sync
Inject JavaScript into HTML, synchronously
https://github.com/hughsk/script-injector-sync
Last synced: 8 days ago
JSON representation
Inject JavaScript into HTML, synchronously
- Host: GitHub
- URL: https://github.com/hughsk/script-injector-sync
- Owner: hughsk
- License: mit
- Created: 2014-04-17T11:10:35.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-04-17T11:10:38.000Z (over 10 years ago)
- Last Synced: 2024-10-17T16:38:57.515Z (22 days ago)
- Language: JavaScript
- Size: 109 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# script-injector-sync [![Flattr this!](https://api.flattr.com/button/flattr-badge-large.png)](https://flattr.com/submit/auto?user_id=hughskennedy&url=http://github.com/hughsk/script-injector-sync&title=script-injector-sync&description=hughsk/script-injector-sync%20on%20GitHub&language=en_GB&tags=flattr,github,javascript&category=software)[![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges) #
Inject JavaScript into HTML, synchronously – intended as an alternative to
[script-injector](http://github.com/dlmanning/script-injector).## Usage ##
[![script-injector-sync](https://nodei.co/npm/script-injector-sync.png?mini=true)](https://nodei.co/npm/script-injector-sync)
### html = inject(html, script) ###
Returns a modified version of `html` with `script` inlined. The script will
either be inserted before the first script on the page, or if there are none
available it will be inserted before the ``'s closing tag.`script` is just arbitrary JavaScript – anything you would otherwise put in a
file or inline manually.## License ##
MIT. See [LICENSE.md](http://github.com/hughsk/script-injector-sync/blob/master/LICENSE.md) for details.