Skip to content
Inject scripts into any website.
Branch: master
Clone or download
Richienb Merge pull request #3 from Richienb/dependabot/npm_and_yarn/google-cl…
…osure-compiler-20190415.0.0

Bump google-closure-compiler from 20190325.0.0 to 20190415.0.0
Latest commit 4946577 Apr 23, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitattributes Update code Mar 15, 2019
.gitignore Update code Mar 15, 2019
.npmignore
.travis.yml GitHub releases regex matching Mar 15, 2019
LICENSE
README.md Add href strategy Mar 16, 2019
_config.yml Rename package again due to conflict Mar 15, 2019
ggscript.js Add href strategy Mar 16, 2019
package.json Bump google-closure-compiler from 20190325.0.0 to 20190415.0.0 Apr 18, 2019
yarn.lock

README.md

Travis CI Build Status CodeFactor Score

GG Script

NPM

Inject scripts into any website.

Importing

From your NodeJS application:

const GGScript = require("ggscript")

From your web application:

<script src="https://unpkg.com/ggscript/ggscript.min.js"></script>

Usage

// Inject a single file
GGScript("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js")

// Inject multiple files
GGScript(["https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js", "https://cdnjs.cloudflare.com/ajax/libs/vue/2.6.9/vue.min.js", "https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.9-1/crypto-js.min.js"])

// Promise integration
GGScript("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js").then((src) => {
    console.log("Finished loading " + src)
})

// Custom options
GGScript("https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js", {
    strategy: "eval"
})

Options

  • strategy: The strategy to use to run the JavaScript. Can be inject, eval or href. Default is automatically detected.

  • injectasync: Load scripts asyncronously when injecting. Default is true.

You can’t perform that action at this time.