-
Notifications
You must be signed in to change notification settings - Fork 2.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
remove bourbon #1883
remove bourbon #1883
Changes from 10 commits
ed29105
a82f8b7
be75b0e
f63a92e
90ef45c
d22a9cc
d4e7245
67442dd
c08943a
df5041b
3420890
bec3de4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,14 @@ $pt-dark-intent-text-colors: ( | |
"danger" : $red5, | ||
) !default; | ||
|
||
@mixin position-all($position, $value) { | ||
position: $position; | ||
top: $value; | ||
right: $value; | ||
bottom: $value; | ||
left: $value; | ||
} | ||
|
||
@mixin base-typography() { | ||
text-transform: none; | ||
line-height: $pt-line-height; | ||
|
@@ -55,7 +63,6 @@ $pt-dark-intent-text-colors: ( | |
} | ||
|
||
@mixin overflow-ellipsis() { | ||
// NOTE: not to be confused with Bourbon ellipsis() which sets `display: inline-block` :( | ||
overflow: hidden; | ||
text-overflow: ellipsis; | ||
white-space: nowrap; | ||
|
@@ -105,3 +112,13 @@ $pt-dark-intent-text-colors: ( | |
@function centered-text($height, $line-height: floor($pt-font-size * $pt-line-height)) { | ||
@return floor(($height - $line-height) / 2); | ||
} | ||
|
||
// Removes the unit from a Sass numeric value (if present). | ||
// strip-unit(12px) => 12 | ||
@function strip-unit($number) { | ||
@if type-of($number) == "number" and not unitless($number) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just verifying: are these built-in SCSS helpers? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. indeed they are |
||
@return $number / ($number * 0 + 1); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
@return $number; | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
// Copyright 2017 Palantir Technologies, Inc. All rights reserved. | ||
// Licensed under the terms of the LICENSE file distributed with this project. | ||
|
||
// these implementations borrowed from Bourbon v5, and modified to fit our use cases. | ||
// changes: removed $asset-pipeline argument, added weight/style params like Bourbon v4. | ||
// https://github.com/thoughtbot/bourbon/blob/master/core/bourbon/library/_font-face.scss | ||
// https://github.com/thoughtbot/bourbon/blob/master/core/bourbon/utilities/_font-source-declaration.scss | ||
|
||
/// Generates an `@font-face` declaration. You can choose the specific file | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why the triple slashes? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I dunno, copy-pasted from bourbon source. I think they use it for doc comments? I'll revert to doubles |
||
/// formats you need to output; the mixin supports `eot`, `ttf`, `svg`, `woff2` | ||
/// and `woff`. | ||
/// | ||
/// @argument {string} $font-family | ||
/// | ||
/// @argument {string} $file-path | ||
/// | ||
/// @argument {string | list} $file-formats | ||
/// List of the font file formats to include. | ||
/// | ||
/// @argument {string} $weight | ||
/// | ||
/// @argument {string} $style | ||
/// | ||
/// @content | ||
/// Any additional CSS properties that are included in the `@include` | ||
/// directive will be output within the `@font-face` declaration, e.g. you can | ||
/// pass in `font-weight`, `font-style` and/or `unicode-range`. | ||
@mixin font-face( | ||
$font-family, | ||
$file-path, | ||
$file-formats, | ||
$font-weight: normal, | ||
$font-style: normal | ||
) { | ||
@font-face { | ||
font-family: $font-family; | ||
font-weight: $font-weight; | ||
font-style: $font-style; | ||
|
||
src: font-source-declaration( | ||
$font-family, | ||
$file-path, | ||
$file-formats | ||
); | ||
|
||
@content; | ||
} | ||
} | ||
|
||
@function font-source-declaration($font-family, $file-path, $file-formats) { | ||
$src: (); | ||
|
||
$formats-map: ( | ||
eot: "#{$file-path}.eot?#iefix" format("embedded-opentype"), | ||
woff2: "#{$file-path}.woff2" format("woff2"), | ||
woff: "#{$file-path}.woff" format("woff"), | ||
ttf: "#{$file-path}.ttf" format("truetype"), | ||
svg: "#{$file-path}.svg##{$font-family}" format("svg"), | ||
); | ||
|
||
@each $key, $values in $formats-map { | ||
@if list-contains($file-formats, $key) { | ||
$file-path: nth($values, 1); | ||
$font-format: nth($values, 2); | ||
|
||
$src: append($src, url($file-path) $font-format, comma); | ||
} | ||
} | ||
|
||
@return $src; | ||
} | ||
|
||
/// Returns true if `$list` contains any of `$values`. | ||
@function list-contains($list, $values...) { | ||
@each $value in $values { | ||
@if type-of(index($list, $value)) != "number" { | ||
@return false; | ||
} | ||
} | ||
|
||
@return true; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ooc, none of our tooling does automatic prefixing by default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oof actually no, we don't run autoprefixer on the generated CSS file. one of the things we lost in the (gulp) fire, along with comment stripping.