Skip to content

Commit

Permalink
udpates for readme, includes munging and docs wiki link
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobo committed Apr 11, 2012
1 parent c0d3149 commit 83cf7c9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ You can visit http://localhost:4000/examples/ for viewing some sample code, or h

Getting Started
===
In case you're looking: [Building Inject From Source](https://github.com/linkedin/inject/wiki/Building-Inject-From-Source)

We've put together a [Getting Started With inject Guide](https://github.com/linkedin/inject/wiki) which is a launching point to all to functionality inject has to offer. If you're already familiar with CommonJS-style modules, than you can probably start right there.

Writing CommonJS Compliant Modules
Expand All @@ -45,6 +47,16 @@ exports.duck = waterfowl

If you injected this file, you could then say `var duck = new moduleName.duck()` and instantiate your object.

JavaScript Minifiers
===
If you're using a JS Minifier for your module files (and you probably should), there are some important compilation options you need. Many minifiers obfuscate and optimize variables inside of functions, which will affect the ability of inject to identify your dependencies before runtime. For the greatest in-browser optimization, we recommend using [UglifyJS](https://github.com/mishoo/UglifyJS) since it allows you to protect specific reserved names while still mazimixing the amount of compression you can do. If running node isn't an option, YUI and Google compressors can also be used with the following options:

* UglifyJS: `--reserved-names “require,exports,module"`
* YUI Compressor: `--nomunge`
* Google Closure: `--compilation_level WHITESPACE_ONLY`

If your compression engine of choice isn't on the list, and has the ability to protect/preserve certain names, send us a bug with the settings and we'll add it to the list. As a last ditch effort, you can often put an `eval();` after your return statement. For most optimizers, the addition of an eval will prevent variable munging within the current scope chain.

API Notes
===
Path Resolution
Expand Down

0 comments on commit 83cf7c9

Please sign in to comment.