rainforestapp/middleman-async-loader

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

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

middleman-async-loader

Provides helper to asynchronously load assets (css, js, webfonts) via injecting script and link tags in Middleman for performance optimisations.

Install
vate :async_assets
Usage

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'

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.