Skip to content

Instantly share code, notes, and snippets.

Jesper Wøldiche woeldiche

Block or report user

Report or block woeldiche

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@scottjehl
scottjehl / noncritcss.md
Last active Jul 22, 2019
Comparing two ways to load non-critical CSS
View noncritcss.md

I wanted to figure out the fastest way to load non-critical CSS so that the impact on initial page drawing is minimal.

TL;DR: Here's the solution I ended up with: https://github.com/filamentgroup/loadCSS/


For async JavaScript file requests, we have the async attribute to make this easy, but CSS file requests have no similar standard mechanism (at least, none that will still apply the CSS after loading - here are some async CSS loading conditions that do apply when CSS is inapplicable to media: https://gist.github.com/igrigorik/2935269#file-notes-md ).

Seems there are a couple ways to load and apply a CSS file in a non-blocking manner:

@woeldiche
woeldiche / template.php
Created Nov 28, 2012
Add classes to fields in egedal theme
View template.php
<?php
/**
* Implements template_preprocess_field().
*
* Adds classes to field based on field name.
*
* Good options are:
* - Field name: $vars['element']['#field_name'].
* - Content type: $vars['element']['#bundle'].
You can’t perform that action at this time.