This repository has been archived by the owner on Sep 13, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 876
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Default settings are contained within the `$_bourbon-defaults` map - User settings to override defaults are placed within a `$bourbon` map
- Loading branch information
Tyson Gach
committed
Feb 5, 2016
1 parent
98f9473
commit 4e43c2d
Showing
10 changed files
with
113 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
/// Return a Bourbon setting. | ||
/// | ||
/// @argument {string} $setting | ||
/// | ||
/// @example scss | ||
/// _bourbon-get-setting(rails-asset-pipeline) | ||
/// | ||
/// @access private | ||
|
||
@function _bourbon-get-setting($setting) { | ||
@return map-get(map-merge($_bourbon-defaults, $bourbon), $setting); | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
@charset "UTF-8"; | ||
|
||
/// Default Bourbon configuration settings. | ||
/// | ||
/// @type map | ||
/// | ||
/// @property {list} global-font-file-formats [("ttf", "woff2", "woff")] | ||
/// Global font file formats for the `font-face` mixin. | ||
/// | ||
/// @property {number (with unit)} modular-scale-base [1em] | ||
/// Global base value for the `modular-scale` function | ||
/// | ||
/// @property {number (unitless)} modular-scale-ratio [$major-third (1.25)] | ||
/// Global base ratio for the `modular-scale` function | ||
/// | ||
/// @property {bool} rails-asset-pipeline [false] | ||
/// Enable or disable the `$asset-pipeline` variable for all functions that | ||
/// accept it. | ||
/// | ||
/// @access private | ||
|
||
$_bourbon-defaults: ( | ||
"global-font-file-formats": ("ttf", "woff2", "woff"), | ||
"modular-scale-base": 1em, | ||
"modular-scale-ratio": $major-third, | ||
"rails-asset-pipeline": false, | ||
); | ||
|
||
/// User overrides of Bourbon configuration settings | ||
/// | ||
/// @type map | ||
|
||
$bourbon: () !default; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
require "spec_helper" | ||
|
||
describe "_bourbon-get-setting" do | ||
before(:all) do | ||
ParserSupport.parse_file("settings/bourbon-get-setting") | ||
end | ||
|
||
context "gets the modular-scale-base setting" do | ||
it "and returns the default value" do | ||
expect(".test-1").to have_rule("content: 1em") | ||
end | ||
end | ||
|
||
context "gets the rails-asset-pipeline setting" do | ||
it "and returns the user-overridden value" do | ||
expect(".test-2").to have_rule("content: true") | ||
end | ||
end | ||
|
||
context "called from the font-face mixin" do | ||
it "outputs user-overridden font file formats" do | ||
ruleset = 'font-family: "source-sans-pro"; ' + | ||
"font-style: normal; " + | ||
"font-weight: normal; " + | ||
'src: font-url("source-sans-pro-regular.woff2") ' + | ||
'format("woff2"), ' + | ||
'font-url("source-sans-pro-regular.woff") ' + | ||
'format("woff");' | ||
|
||
expect("@font-face").to have_ruleset(ruleset) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@import "setup"; | ||
|
||
$bourbon: ( | ||
"global-font-file-formats": ("woff2", "woff"), | ||
"rails-asset-pipeline": true, | ||
); | ||
|
||
.test-1 { | ||
content: _bourbon-get-setting("modular-scale-base"); | ||
} | ||
|
||
.test-2 { | ||
content: _bourbon-get-setting("rails-asset-pipeline"); | ||
} | ||
|
||
@include font-face("source-sans-pro", "source-sans-pro-regular"); |