Js closure wrap module for the Asset Pipeline
Groovy
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
gradle/wrapper
src
.gitignore
README.adoc
build.gradle
gradlew
gradlew.bat

README.adoc

Js Closure Wrap Asset-Pipeline

The js-closure-wrap-asset-pipeline is an Asset Pipeline module that wraps javascript files in immediately executing anonymous closures to prevent variables from creeping into the global scope.

Getting Started

Gradle / Grails 3

Getting started

Gradle / Grails 3

build.gradle
plugins {
    id 'com.bertramlabs.asset-pipeline' version '2.5.0'
}

dependencies {
    assets 'com.craigburke:js-closure-wrap-asset-pipeline:1.2.0'
}

How it Works

This plugin will take a JavaScript file with a wrapped directive option like this:

//= wrapped
var foo = 'Bar';
console.log(foo);

And will wrap it in a closure like this:

(function() {
    "use strict";
    var foo = 'Bar';
    console.log(foo);
})();