Skip to content
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

Enable sass compiling in webpack for chrome styles #107

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/b-ber-themes/b-ber-theme-crimson/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.DS_Store
node_modules
.sass-cache
2 changes: 2 additions & 0 deletions packages/b-ber-themes/b-ber-theme-crimson/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/demo
/demo.scss
1 change: 1 addition & 0 deletions packages/b-ber-themes/b-ber-theme-crimson/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# b-ber-theme-serif
22 changes: 22 additions & 0 deletions packages/b-ber-themes/b-ber-theme-crimson/_debug.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@if $debug == true {
#debug-grid {
font-family: 'debug';
font-size: $font-size-base;
line-height: $line-height-base;
}
.line {
position: absolute;
pointer-events: none;
height: 1px;
margin: 0;
padding: 0;
left: 0;
right: 0;
background-color: pink;
}

h1,h2,h3,h4,h5,h6,p {
width: 100%;
background-color: rgba(255,255,0,0.2);
}
}
203 changes: 203 additions & 0 deletions packages/b-ber-themes/b-ber-theme-crimson/_mixins.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,203 @@

//
// Media Queries
//
//
@mixin break($media) {
@if $media == 'mobile' {
@media #{$media-mobile} { @content }
}
@else if $media == 'tablet' {
@media #{$media-tablet} { @content }
}
@else if $media == 'desktop' {
@media #{$media-desktop} { @content }
}
@else {
@if feature-exists('at-error') == true {
@error "`#{$media}` is not a supported media type.";
}
@else {
@warn "`#{$media}` is not a supported media type.";
}
}
}



//
// Typography
//
//


// font-face utility mixin
// @example @include font-face('Crimson', 'TC-crimson-italic-webfont', ('ttf'), 400, italic);
@mixin font-face($font-name, $file-name, $formats:('ttf', 'otf'), $weight: 400, $style: normal) {
$filepath: "../fonts/" + $file-name;
@font-face {
font-family: "#{$font-name}";
@each $format in $formats {
src: url($filepath + "." + $format);
}
font: {
weight: $weight;
style: $style;
}
}
}

// General typographic settings
@mixin hyphens($hyphenation:auto) {
-webkit-hyphens: $hyphenation;
-epub-hyphens: $hyphenation;
adobe-hyphenate: $hyphenation;
-moz-hyphens: $hyphenation;
-ms-hyphens: $hyphenation;
hyphens: $hyphenation;
}

@mixin widows($n:2) {
widows: $n;
}

@mixin orphans($n:1) {
orphans: $n;
}

@mixin text-rendering($value:optimizeLegibility) {
text-rendering:$value;
}

@mixin font-smoothing {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}





// Remove units from a value
// @example strip-unit(1em) // => 1
@function strip-unit($value) {
@if type-of($value) == 'number' and not unitless($value) {
@return $value / ($value * 0 + 1);
}
@return $value;
}

// Returns a unitless line-height value, relative to an element's font size.
// Calculated by using the global `$line-height-base`
// @example line-height(11.390625em) // => 1.037037037
@function line-height($font-size) {
@return ceil($font-size / $line-height-base) * ($line-height-base / $font-size);
}

// Returns a value for a single line-height unit in `em`s, relative to the
// element's font-size. Useful for consistently spacing top/bottom
// margin/padding
// @example adjust-line-height-value(0) // => 1.3125em
// @example adjust-line-height-value(6) // => 0.1152263374em
@function adjust-line-height-value($value) {
@return $line-height-base / strip-unit(ms($value)) + 0em;
}

// Returns a value for a single em in `em`s, relative to the
// element's font-size.
// @example adjust-font-size-value(1) // => 1em
// @example adjust-font-size-value(2) // => 2em
@function adjust-font-size-value($value) {
// @return $font-size-base / strip-unit(ms($value)) + 0em;
@return strip-unit(ms($value)) + 0em;
}

// Compose typographic styles
@mixin type-settings($value) {
font-size: ms($value);
line-height: line-height(ms($value));
@if $vertical-space == true {
margin-bottom: adjust-line-height-value($value);
}
}


// Abstract wrappers for element spacing
// @param $n int How many spaces?
// @param $value int The modular scale index of the element
@function n-lines($n, $value) {
@return adjust-line-height-value($value) * $n + 0em;
}
@function n-ems($n, $value) {
@return adjust-font-size-value($value) * $n + 0em;
}

// Convenience wrappers for element spacing.
// @param $value int The modular scale index of the element
// @example margin-top: one-line(0); // => margin-top: 1.3125em;
@function one-line($value) { @return n-lines(1, $value); }
@function two-lines($value) { @return n-lines(2, $value); }
@function three-lines($value) { @return n-lines(3, $value); }
@function four-lines($value) { @return n-lines(4, $value); }
@function five-lines($value) { @return n-lines(5, $value); }

// @param $value int The modular scale index of the element
// @example margin-top: one-em(0); // => margin-top: 1em;
@function one-em($value) { @return n-ems(1, $value); }
@function two-ems($value) { @return n-ems(2, $value); }
@function three-ems($value) { @return n-ems(3, $value); }
@function four-ems($value) { @return n-ems(4, $value); }
@function five-ems($value) { @return n-ems(5, $value); }


// Add padding programatically based on font-size
// @param $top int Number of line-height units at type-settings(0) to add as padding-top
// @param $left int Number of `em`s at type-settings(0) to add as padding-left
// @param $bottom int Number of line-height units at type-settings(0) to add as padding-bottom
// @param $right int Number of `em`s at type-settings(0) to add as padding-right
// @param $value int Elements type-settings index
// @example padding: @include padding(1, 1, 1, 1, 0) // => padding: 1em 1.3125em 1em 1.3125em;
@mixin padding($top, $right, $bottom, $left, $value) {
padding:
// adjust-line-height-value($value) * ($top * 4) + 0em // to account for halved line-height
adjust-line-height-value($value) * $top + 0em
adjust-font-size-value($value) * $right + 0em
// adjust-line-height-value($value) * ($bottom * 4) + 0em // to account for halved line-height
adjust-line-height-value($value) * $bottom + 0em
adjust-font-size-value($value) * $left + 0em
;
}

// Defaults to 16px, assuming the `html` element's base font size
@function em-to-px($value, $root-px: 16px) {
@return strip-unit($value) * strip-unit($root-px) + 0px;
}


@mixin following-paragraph-not-indented {
+ p { text-indent: 0!important; }
}
@mixin following-element-has-no-top-padding {
+ table, + ul, + ol, + dl, + blockquote { padding-top: 0; }
+ hr { margin-top: one-line(0); }
}


@mixin bullet-container {
text-indent: 0;
margin-left: one-em(0);
}

@mixin bullet {
display: inline-block;
text-indent: one-em(0) * -1;
}


// Alert colours
$alert: (
'info' : $info,
'warning' : $warning,
'danger' : $danger,
'success' : $success,
);
83 changes: 83 additions & 0 deletions packages/b-ber-themes/b-ber-theme-crimson/_settings.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
//
// Variables
//


// Media Queries
$media-mobile: 'only screen \
and (min-width: 320px) \
and (max-width: 680px)' !default;
$media-tablet: 'only screen \
and (min-width: 680px) \
and (max-width: 768px)' !default;
$media-desktop: 'only screen \
and (min-width: 680px)' !default;

// Colors
$white: #fff !default;
$black: #222 !default;
$grey: #eee !default;
$dimgrey: #696969 !default;
$info: #26A4B7 !default;
$warning: #DA4539 !default;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tabs!

$danger: #CD8D59 !default;
$success: #5050C5 !default;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's def a tab


// Set `$grey` in case of e-ink readers
@if $build == 'mobi' {
$grey: $black;
}

// highlight.js theme name. Eventually this will pull in the appropriate CSS
// from highlight.js. Currently there's no way to use dynamic imports with SCSS,
// so this will either have to be managed elsewhere
// $syntax-highlighting: 'dracula' !default;

// Layout
$debug: false !default;
$text-indent: true !default;
$vertical-space: false !default;

// Font Size
$font-size-base: 1em !default;
$line-height-base: 1.35 !default;

// Typgraphic Scale
//
// Function Ratio Decimal value
// --- --- ---
// $font-scale: 'phi' ;// 1:1.618 1.618
// $font-scale: 'golden' ;// 1:1.618 1.618
// $font-scale: 'double-octave' ;// 1:4 4
// $font-scale: 'major-twelfth' ;// 1:3 3
// $font-scale: 'major-eleventh' ;// 3:8 2.667
// $font-scale: 'major-tenth' ;// 2:5 2.5
// $font-scale: 'octave' ;// 1:2 2
// $font-scale: 'major-seventh' ;// 8:15 1.875
// $font-scale: 'minor-seventh' ;// 9:16 1.778
// $font-scale: 'major-sixth' ;// 3:5 1.667
// $font-scale: 'minor-sixth' ;// 5:8 1.6
// $font-scale: 'fifth' ;// 2:3 1.5
// $font-scale: 'augmented-fourth' ;// 1:√2 1.414
// $font-scale: 'fourth' ;// 3:4 1.333
// $font-scale: 'major-third' ;// 4:5 1.25
// $font-scale: 'minor-third' ;// 5:6 1.2
// $font-scale: 'major-second' ;// 8:9 1.125
// $font-scale: 'minor-second' ;// 15:16 1.067

$font-scale: 'minor-second' !default;

// Font stacks
$crimson: 'Crimson', Georgia, Times, serif !default;
$sans: Helvetica, Arial, sans-serif !default;
$serif: Iowan, Georgia, Times, serif !default;
$mono: Menlo, Osaka, Monaco, monospace !default;

$font-family-base: $crimson !default;

// Inline image element dimensions as int, interpreted as ems
$landscape-image-height: 4 !default;
$square-image-height: 4 !default;
$portrait-image-height: 5 !default;
$portrait-image--high-height: 5 !default;

Loading