GitXplorerGitXplorer
p

jquery.environment

public
2 stars
0 forks
0 issues

Commits

List of commits on branch master.
Unverified
eba1dd715b575d14bc8573202bd2c7a97cc875bd

Merge pull request #1 from bitdeli-chef/master

ppboling committed 11 years ago
Unverified
2c6c0fa1e72ed75fc6e02f1be6f0b579acf092d2

Add a Bitdeli badge to README

bbitdeli-chef committed 11 years ago
Unverified
f468b465889a97c374aa5b0dbbd99c4cf0a86e8c

Update README.md

ppboling committed 12 years ago
Unverified
e1aeee13cd524729177abc801b61c91003776dcc

Coderwall link

ppboling committed 12 years ago
Unverified
e8c2dcf3a29793c7b15b6bbb07ddf3626fabe676

Added example configuration script

ppboling committed 12 years ago
Unverified
c9b6255f19ff5f82e8affad11eeae4d1020e2041

Added CHANGELOG

ppboling committed 12 years ago

README

The README file for this repository.

jQuery Environment Plugin Endorse Me

Allows the setting of environment specific configuration. The jQuery equivalent of Rails' config/environments files.

NOTE: Do not use this plugin to store 'secret' data about your app, or you will be exposing it to your DOM, and thereby hackety-hackers.

Use without DOM (globally):

Option 1.

 Example:

     // Setup in a conditionally loaded script, see example/jquery-environment-config.js.erb
     $.environment({ here: 'dragon', env_name: 'production', foo: 'bar'});

     // Usage elsewhere
     $.environment.config('here');       // dragon
     $.environment.config('env_name');   // production
     $.environment.config('foo');        // bar

Two (three!) ways to use with DOM:

Option 1. via the data-environment attribute on any HTML element.

 Example:

     <body data-environment-configuration="{foo: 'bar'}">)

Option 2. via the instantiation options for the plugin.

 Example:

     $('body').environment({ here: 'dragon', env_name: 'production' });

Option 3. Option 1 + Option 2

 Example:

     // Do both of the above examples and then you get this usage:
     $('body').environment.config('foo');      // bar
     $('body').environment.config('here');     // dragon
     $('body').environment.config('env_name'); // production

Author: @pboling

Version: 1.0

Release Date: November 12, 2012

Based on: 'Highly configurable' mutable plugin boilerplate by @markdalgleish and @addyosmani, see http://coding.smashingmagazine.com/2011/10/11/essential-jquery-plugin-patterns/

Versioning

This library aims to adhere to Semantic Versioning 2.0.0. Violations of this scheme should be reported as bugs. Specifically, if a minor or patch version is released that breaks backward compatibility, a new version should be immediately released that restores compatibility. Breaking changes to the public API will only be introduced with new major versions.

License

MIT license

Notes

Note that with this pattern, as per Alex Sexton's, the plugin logic hasn't been nested in a jQuery plugin. Instead, we just use jQuery for its instantiation.

Bitdeli Badge