Skip to content

Latest commit

 

History

History
47 lines (35 loc) · 953 Bytes

README.adoc

File metadata and controls

47 lines (35 loc) · 953 Bytes

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);
})();