-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
experimental source of truth and JS break-out
- Loading branch information
1 parent
89c525e
commit ba1682f
Showing
7 changed files
with
222 additions
and
16 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
const defaultFontSize = 16; | ||
|
||
function calculateRem(valueInPixals){ | ||
valueInPixals = parseFloat(valueInPixals.replace('px', '')); | ||
return `${valueInPixals / defaultFontSize}rem`; | ||
} | ||
|
||
const framework = { | ||
variables: { | ||
defaultFontSize: defaultFontSize | ||
}, | ||
spacers: { | ||
xxs: calculateRem("4px"), | ||
xs: calculateRem("8px"), | ||
sm: calculateRem("16px"), | ||
md: calculateRem("24px"), | ||
lg: calculateRem("32px"), | ||
xl: calculateRem("48px"), | ||
xxl: calculateRem("64px") | ||
}, | ||
gridBreakpoints: { | ||
sm: calculateRem("0px"), | ||
md: calculateRem("768px"), | ||
lg: calculateRem("1024px"), | ||
xl: calculateRem("1440px") | ||
}, | ||
gridBreakpointsMax: { | ||
sm: calculateRem("767px"), | ||
md: calculateRem("1023px"), | ||
lg: calculateRem("1439px") | ||
} | ||
}; | ||
|
||
export default framework; |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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
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,39 @@ | ||
'use strict'; | ||
|
||
const fs = require('fs'); | ||
import cssFramework from './js/framework'; //This is possible with the ESM lib | ||
|
||
function readInTemplate(fileName) { | ||
try { | ||
return fs.readFileSync(fileName, 'utf8'); | ||
} catch (err) { | ||
console.error(err) | ||
} | ||
} | ||
|
||
//Process Variables | ||
const variables = cssFramework.variables; | ||
let variableTmpl = readInTemplate("./templates/_variables.scss.tmpl"); | ||
for (let [key, value] of Object.entries(variables)) { | ||
variableTmpl = variableTmpl.replace(`#(${key})`, value); | ||
} | ||
fs.writeFileSync('./scss/_variables.scss', variableTmpl); | ||
|
||
//Process Breakpoints and Spacers | ||
const spacers = cssFramework.spacers; | ||
let breakPointTmpl = readInTemplate("./templates/_breakpoints.scss.tmpl"); | ||
for (let [key, value] of Object.entries(spacers)) { | ||
breakPointTmpl = breakPointTmpl.replace(`#(${key})`, value); | ||
} | ||
const gridBreakpoints = cssFramework.gridBreakpoints; | ||
for (let [key, value] of Object.entries(gridBreakpoints)) { | ||
breakPointTmpl = breakPointTmpl.replace(`#(${key})`, value); | ||
} | ||
const gridBreakpointsMax = cssFramework.gridBreakpointsMax; | ||
for (let [key, value] of Object.entries(gridBreakpointsMax)) { | ||
breakPointTmpl = breakPointTmpl.replace(`#(${key})`, value); | ||
} | ||
fs.writeFileSync('./scss/_breakpoints.scss', breakPointTmpl); | ||
|
||
|
||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// Scss Breakpoints | ||
// | ||
// Styleguide 1.2.0 | ||
|
||
|
||
// $spacers | ||
// | ||
// Scss map of all the spacing sizes for all breakpoints | ||
// | ||
// Styleguide 1.2.1 | ||
$spacers: ( | ||
xxs: #(xxs), | ||
xs: #(xs), | ||
sm: #(sm), | ||
md: #(md), | ||
lg: #(lg), | ||
xl: #(xl), | ||
xxl: #(xxl) | ||
) !default; | ||
|
||
// $grid-breakpoints | ||
// | ||
// Scss map of all the breakpoints for the grid system | ||
// | ||
// Styleguide 1.2.2 | ||
$grid-breakpoints: ( | ||
sm: #(sm), | ||
md: #(md), | ||
lg: #(lg), | ||
xl: #(xl) | ||
) !default; | ||
|
||
$grid-breakpoints-max:( | ||
sm: #(sm), | ||
md: #(md), | ||
lg: #(lg) | ||
) !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,88 @@ | ||
// SCSS | ||
// | ||
// This section will cover the Scss variables, mixens and functions that are used to build out the framework | ||
// | ||
// Styleguide 1.0.0 | ||
|
||
|
||
// Scss Variables | ||
// | ||
// Scss variables are used so that adjustments can be made in a centralized location and to keep | ||
// the code base DRY. | ||
// | ||
// Styleguide 1.1.0 | ||
|
||
|
||
|
||
// $default-font-size | ||
// | ||
// Default font size. This is important as it will be used to convert pixel values to rems | ||
// | ||
// Styleguide 1.1.1 | ||
$default-font-size: #(defaultFontSize) !default; | ||
|
||
|
||
// $grid-columns | ||
// | ||
// Sass variable that sets the default number of columns used in the CSS Grid system. | ||
// | ||
// Styleguide 1.1.2 | ||
$grid-columns: 12 !default; | ||
|
||
$base-col-percent: 100% / $grid-columns; | ||
|
||
// $primary-font-family | ||
// | ||
// Sass variable that sets the primary font family. | ||
// | ||
// Styleguide 1.1.3 | ||
$primary-font-family: Arial, "Helvetica Neue", Helvetica, sans-serif !default; | ||
|
||
// $secondary-font-family | ||
// | ||
// Sass variable that sets the secondary font family. | ||
// | ||
// Styleguide 1.1.4 | ||
$secondary-font-family: Georgia,Times,Times New Roman,serif !default; | ||
|
||
// $font-weight-light | ||
// | ||
// Sass variable that sets light font weight. | ||
// | ||
// Styleguide 1.1.5 | ||
$font-weight-light: 300; | ||
|
||
// $font-weight-normal | ||
// | ||
// Sass variable that sets the normal font weight. | ||
// | ||
// Styleguide 1.1.6 | ||
$font-weight-normal: 400; | ||
|
||
// $font-weight-semibold | ||
// | ||
// Sass variable that sets the semi-bold font weight. | ||
// | ||
// Styleguide 1.1.7 | ||
$font-weight-semibold: 500; | ||
|
||
// $font-weight-bold | ||
// | ||
// Sass variable that sets the bold font weight. | ||
// | ||
// Styleguide 1.1.8 | ||
$font-weight-bold: 700; | ||
|
||
// $line-height-base | ||
// | ||
// Sass variable that sets the default line height. | ||
// | ||
// Styleguide 1.1.9 | ||
$line-height-base: 1.5 !default; | ||
|
||
// $$headings-line-height | ||
// | ||
// Sass variable that sets the line height for headers. | ||
// | ||
// Styleguide 1.1.10 | ||
$headings-line-height: 1.2 !default; |