Name: middleman-async-loader
Owner: Rainforest QA
Description: Generates javascript to asynchronously inject scripts and stylesheets
Created: 2016-10-04 11:07:12.0
Updated: 2017-06-09 14:13:58.0
Pushed: 2018-01-02 19:21:27.0
Homepage: https://www.rainforestqa.com/
Size: 5
Language: Ruby
GitHub Committers
User | Most Recent Commit | # Commits |
---|
Other Committers
User | Most Recent Commit | # Commits |
---|
Provides helper to asynchronously load assets (css, js, webfonts) via injecting script and link tags in Middleman for performance optimisations.
gem 'middleman-async-assets'
in your Gemfilebundle
config.rb
, put followingvate :async_assets
The helper generates javascript. So you need to use it inside a script tag like so:
ipt
async_css 'screen'
async_js 'https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js', 'boom', 'whatever'
async_font 'https://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700'
And you can also load js assets like this:
ipts
async_js_in_order 'jquery', 'my-thing-dependent-on-jquery'