Skip to content

vishwanatharondekar/RequireCSS

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

#NOTE

A better plugin with all the cases handled, good support for r.js and less is available at https://github.com/guybedford/require-css. You should better have look at that if you are looking at this.


RequireCSS (RequireJS css! plugin)

A RequireJS plugin which loads and waits for css files. Uses the standard load event on browsers which support it (IE, Firefox 9+, Opera) and uses a script tags load & error events as a workaround (Chrome, Safari, Firefox < 9). Detection of link load event support is done using a link element with a data url, which fires onload immediately when supported.

Only caveats in browsers not supporting the native link load event are that there will be JavaScript parse errors (since browsers try to interpret the dummy script tags used for load event detection) and there will be no RequireJS error message when a stylesheet could not be found/loaded. Also beware of IE's 31 style sheets limit (fixed in IE 10).

Compatibility

  • Firefox 1.0.1+
  • Safari 3.2+
  • Mobile Safari 4 (iOS 3.2)+
  • Chrome 1+
  • Opera 9.5+
  • IE 6+

Planned

  • Media-Query support
  • r.js optimizer support

Credits

About

A css plugin for RequireJS

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%