AsyncCSS
A function for asynchronous loading of non-critical CSS and deferring Web Fonts, which leverages localStorage for caching. When a new version of file supplied (app.css?v2) any old versions (app.css?xx) are being removed from localStorage automatically
This work heavily influenced by
- Breaking news at 1000ms, Patrick Hamann, The Guardian
- BBC News team optimization experiments
- Improving Smashing Magazine’s Performance: A Case Study
Licensed MIT
Install
With npm do:
npm install asynccss --save
With bower do:
bower install asynccss --save
Usage
Example
...
Run automated-tests
$grunt mocha_phantomjs
Changelog
- 0.0.5 - Garbage collector now removes only old version of a provided css file.
- 0.0.4 - Automated tests supplied
- 0.0.3 - A separate cache namespace can be supplied now per asyncCss call
- 0.0.2 - Hotfix: missing early exit was causing async loading even after CSS is present in the cache
- 0.0.1 - First commit