Skip to content

Richienb/ggscript

Repository files navigation

GG Script

Inject scripts into any website.

Travis CI Build Status CodeFactor Score

NPM

Importing

From your NodeJS application:

const GGScript = require("ggscript")

From your web application:

<script src="https://unpkg.com/ggscript/dist/index.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(() => {
    console.log("Finished loading resources.")
}).catch((err) => {
    console.error("Something bad just happened! " + err)
})

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

Usage

Read the documentation.