https://github.com/blakek/addtopage
Inject content to your page how you want—using JavaScript
https://github.com/blakek/addtopage
addtopage injector javascript resource resource-injector tiny
Last synced: about 1 month ago
JSON representation
Inject content to your page how you want—using JavaScript
- Host: GitHub
- URL: https://github.com/blakek/addtopage
- Owner: blakek
- License: mit
- Created: 2016-06-14T21:33:56.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2022-12-07T04:11:58.000Z (over 3 years ago)
- Last Synced: 2025-11-12T11:32:12.455Z (9 months ago)
- Topics: addtopage, injector, javascript, resource, resource-injector, tiny
- Language: JavaScript
- Homepage:
- Size: 1.38 MB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 44
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# addtopage
> a tiny resource injector
[](https://travis-ci.org/blakek/addtopage)
[](https://www.npmjs.com/package/addtopage)

[](https://www.npmjs.com/package/addtopage)
## What's it do?
This helps add content to a web page using one line of code when all you remember is the URI. For example, if you want to add Moment.js to a page, you can just:
```javascript
addtopage('http://momentjs.com/downloads/moment.min.js')
```
But it doesn't just load JavaScript. You can load images and stylesheets now, and lots more is planned.
```javascript
// add an image
addtopage('/path/to/an/image')
// add a stylesheet
addtopage('//maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css')
```
## What's the point in using this?
It's original purpose was so I could inject stuff into a page without having to actually edit the page — anything I needed could be added from the browser console.
However, it can also be used to asynchronously load site assets using one line of code.
Even though this is currently a tiny, simple asset-loading library (if it can even be called a "library"), lots of awesome stuff is planned in the near future!