Skip to content

WHY RAILS... and fonts

Compare
Choose a tag to compare
@annez annez released this 02 Dec 17:28
· 1358 commits to master since this release

Fixes

Rails 4 and Sprockets introduced an asset dependency on gems that required us to add in explicit precompilation of our images. This meant you would get an Sprockets::Helpers::RailsHelper::AssetPaths::AssetNotPrecompiledError when running in Rails 4. This has now been fixed with this:
https://github.com/uswitch/ustyle/blob/master/lib/ustyle/engine.rb#L10

Unfortunately it's not the nicest fix, but it's the best we can do for now. Because sprockets

Quicker imports

You can now import all the required files with

@import "ustyle/global"

This imports all the important variables, fonts, font settings, mixins and base.

Fonts

Font declarations now reside in uStyle. This means any external project or project not relying on the includes can quickly load all the uSwitch fonts with two variables:

/// If using a uStyle project outside of www.uswitch.com domain or one that lacks the power the includes, then
/// set this to `true` to import the correct `@font-face` declarations.
///
/// @group fonts
/// @type Bool

$needs-font: false !default;

/// Same as `$needs-font` but also imports the EOT's so that fonts work in < IE8
///
/// @group fonts
/// @type Bool

$needs-font-ie: false !default;

/// Set this to wherever you are serving the uSwitch fonts from.
///
/// @group fonts
/// @type String

$base-font-url: "//fonts.uswitch.com/" !default;

Set these to true at the top of your Sass files to enable font loading.