Giter VIP home page Giter VIP logo

yepnope.js's Introduction

#yepnope.js#

A Conditional Script Loader For Your Polyfills, or Regressive Enhancement With Style.

A small script loader to help use feature detection to load exactly the scripts that your user needs, not just all the scripts that you think they might need.

More docs, etc at: http://yepnopejs.com

By:

Alex Sexton - AlexSexton [at] gmail

Ralph Holzmann - RalphHolzmann [at] gmail

Follow: @SlexAxton and @ralphholzmann on Twitter for more updates.

##A simple example (assuming modernizr is there):##

yepnope([
  {
    test : Modernizr.indexeddb,
    yep  : ['/js/indexeddb-wrapper.js', '/css/coolbrowser.css'],
    nope : ['/js/polyfills/lawnchair.js', '/js/cookies.js', '/css/oldbrowser.css']
  }
]);

Any forks and stuff are welcome.

##Current Released Version##

1.5.4

(NOTE:: there were some problems with 1.5.0 in IE, we strongly suggest an upgrade to 1.5.3+)

Changes in 1.5+ :

  • Scripts with the same url don't reexecute, but their callbacks fire in the correct order.
  • The complete function behaves much more like the callback function with respect to 'recursive yepnope'.
  • CSS load callbacks were taken out by default and put in an official plugin. Too few people used it. Old code will still work, callbacks just fire immediately on CSS (unless css load plugin is included).
  • We exposed yepnope.injectJs and yepnope.injectCss in order to give you direct access to the injection functions.
  • We added the ability to use key/value pairs in prefixes.
  • We added a builtin prefix for overriding the global yepnope.errorTimeout with a specific timeout per script. yepnope('timeout=5000!script.js');
  • We smarten'd up detection of CSS files even if there are query parameters (without the use of the css prefix plugin)
  • We added the ability to write filters and prefixes that add arbitrary attributes on the eventual script and link tags.
  • We removed the old and busted demo/ folder since we just use the tests folder for everything.
  • We just assume you have uglifyjs if you're running our compress script.

NOTE: the code in the github repository is considered in development. Use at your own risk. The download buttons will link to our current release version.

##License##

All of the yepnope specific code is under the WTFPL license. Which means it's also MIT and BSD (or anything you want). However, the inspired works are subject to their own licenses.

All contributions to yepnope should be code that you wrote, and will be subject to the Dojo CLA. By sending a pull request, you agree to this. All commits thus far have also been committed under this license.

##Thanks##

Dave Artz - A.getJS was a huge code-inspiration for our loader. So he's responsible for a ton of awesome techniques here.

Kyle Simpson - He is the creator of LABjs of which a lot of this is inspired by.

Stoyan Stefanov - His work on resource preloading has been awesome: (http://www.phpied.com/preload-cssjavascript-without-execution/)[http://www.phpied.com/preload-cssjavascript-without-execution/]

Steve Souders - His evangelism and work in the space (ControlJS) have brought light to the issues at hand, he is the father of front-end performance.

Paul Irish - Thanks or whatever.

yepnope.js's People

Contributors

slexaxton avatar knpwrs avatar crodas avatar patmoore avatar mjc-gh avatar peeter-tomberg avatar ixti avatar davidpadbury avatar dmitrybaranovskiy avatar kennethkufluk avatar designbyonyx avatar stristr avatar timoxley avatar yousseftaghlabi avatar bugdebugger avatar james-stephenson avatar

Watchers

Steve Temple avatar James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.