Skip to content

Commit

Permalink
📦 New option to toggle output of function
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisburnell committed Apr 12, 2021
1 parent e7e6c07 commit 13c5d61
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 3 deletions.
1 change: 1 addition & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.github
.vscode
*.css
12 changes: 12 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"workbench.colorCustomizations": {
// "activityBar.background" : "#507791",
// "activityBar.foreground" : "#f9f9f9",
"titleBar.activeBackground" : "#4f758e",
"titleBar.activeForeground" : "#f9f9f9",
"titleBar.inactiveBackground" : "#44657A",
"titleBar.inactiveForeground" : "#f9f9f9",
"statusBar.background" : "#4f758e",
"statusBar.foreground" : "#f9f9f9"
}
}
10 changes: 10 additions & 0 deletions .vscode/snippets.code-snippets
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"CSS Variable Fallback": {
"description": "De-abstracts variables from their colloquial names into their programmatic goodness and provides a fallback to the CSS Variables.",
"scope": "scss",
"prefix": "v",
"body": [
"@include v($1, $2);"
]
}
}
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@chrisburnell/bowhead",
"version": "0.1.8",
"version": "0.1.9",
"description": "Memorable and maintainable design tokens in SCSS",
"main": "bowhead.scss",
"scripts": {
Expand All @@ -21,6 +21,7 @@
"url": "https://github.com/chrisburnell/bowhead/issues"
},
"keywords": [
"design tokens",
"scss"
]
}
4 changes: 4 additions & 0 deletions src/_config.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// Decides whether or not use the CSS Variable or raw value when calling the
// @v function.
$bowhead-variable-as-default: true !default;

// Decides whether or not to show a fallback value for the CSS Variable.
$bowhead-show-fallback: true !default;

Expand Down
2 changes: 1 addition & 1 deletion src/_functions.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
///
/// @return Associated CSS Variable or SCSS value
///
@function v($property, $value: default, $fallback: false) {
@function v($property, $value: default, $fallback: not $bowhead-variable-as-default) {
$generic-values: auto, inherit, initial, none, revert, unset, 0, 1, 100%, currentColor;
@if (index($generic-values, $value)) {
@return $value;
Expand Down
2 changes: 1 addition & 1 deletion src/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@
@if $show-fallback {
#{$property}: v($property, $value, true);
}
#{$property}: v($property, $value);
#{$property}: v($property, $value, false);
}

0 comments on commit 13c5d61

Please sign in to comment.