• Stars
    star
    221
  • Rank 179,773 (Top 4 %)
  • Language
    HTML
  • License
    MIT License
  • Created over 10 years ago
  • Updated over 5 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Super easy to use Sass mixins to establish a typographic system with modular scale and vertical rhythm. Based on the Gridlover app.

Sassy-Gridlover Build Status

Super easy to use Sass mixins to establish a typographic system with modular scale and vertical rhythm. Based on the Gridlover app.

Gridlover gives you adjustable CSS for font sizes, line heights and margins. The default CSS output is for html, body, h1-h6, p, ul, ol, etc. but you can of course apply your adjusted values to any element by editing the CSS later.

First of all

Go play around with the awesome Gridlover app!

It's so much fun! ๐Ÿ˜„

Installation

Install Sassy-Gridlover via bower.

$ bower install sassy-gridlover

Install Sassy-Gridlover via npm.

$ npm install sassy-gridlover

Install Sassy-Gridlover via yarn.

$ yarn add sassy-gridlover

or Download the repository and include the sassy-gridlover folder to your Sass directory.

Getting started

Sassy-Gridlover consists of 7 configurable variables:

$sgl-base-font-size;
$sgl-base-line-height;
$sgl-base-unit;
$sgl-scale-factor;
$sgl-debug-mode;
$sgl-debug-mode-max-width;
$sgl-extras;

and 4 mixins:

@mixin sgl-html();
@mixin sgl-body();
@mixin sgl-heading();
@mixin sgl-margins();

These are the 4 functionalities of the Gridlover app that you (should) have been playing with ;)

Setup

Import _sassy-gridlover.scss to your main style sheet.

@import "sassy-gridlover";

Change the configurable variables values in _config.scss to your liking.

I would encourage you not to change them directly here, though. It would be better to declare them in your _variables.scss, _config.scss or the like.

Mixins

By default, all the mixins (except sgl-html) will output em. But you can also choose to output px, rem or pxrem.

sgl-html()

This mixin is mandatory for the all the other mixins to work.

To use on <html>.

Outputs font-size and line-height always in px.

html {
    @include sgl-html($font-size: $sgl-base-font-size);
}

Parameters

Name Description Type Default value
$font-size Root font size. Number $sgl-base-font-size

sgl-body()

To use on <body>.

Outputs font-size and line-height.

body {
    @include sgl-body($line-height-step: 0, $unit: $sgl-base-unit);
}

Parameters

Name Description Type Default value
$line-height-step Multiplies the step number by the base line-height (from sgl-html). If 0 is set, it will actually multiply by 1. Number 0
$unit Unit to output (px, em, rem, pxrem). String $sgl-base-unit

sgl-heading()

To use on headings <h1> - <h6>.

Outputs font-size, line-height, margin-top and margin-bottom.

@include sgl-heading($font-size-step, $line-height-step, $margin-top-step, $margin-bottom-step, $unit: $sgl-base-unit, $base-value: $sgl-base-font-size)

Parameters

Name Description Type Default value
$font-size-step Creates an exponent of the base font-size (from sgl-html) in conjunction with sgl-scale-factor. 0 is the base font-size. Number -
$line-height-step Multiplies the step number by the base line-height (from sgl-html). If 0 is set, the line-height will grow with the font-size accordingly. Number -
$margin-top-step Multiplies the step number by the base line-height (from sgl-html). Number -
$margin-bottom-step Multiplies the step number by the base line-height (from sgl-html). Number -
$unit Unit to output (px, em, rem, pxrem). String $sgl-base-unit
$base-value Optional parameter for a different base font size when using em. Number $sgl-base-font-size

sgl-margins()

To use on <p>, <ul>, <ol>, <pre>, <table>, <blockquote>, etc.

Outputs margin-bottom and margin-top.

@include sgl-margins($margin-top-step, $margin-bottom-step, $unit: $sgl-base-unit, $base-value: $sgl-base-font-size)

Parameters

Name Description Type Default value
$margin-top-step Multiplies the step number by the base line-height (from sgl-html). Number -
$margin-bottom-step Multiplies the step number by the base line-height (from sgl-html). Number -
$unit Unit to output (px, em, rem, pxrem). String $sgl-base-unit
$base-value Optional parameter for a different base font size when using em. Number $sgl-base-font-size

Debug mode

Enables/disables debug mode.

Outputs background lines imitating a notebook's sheet.

Parameters

Name Description Type Default value
$sgl-debug-mode Enables/disables debug mode. Boolean false

Declare it in your own _variables.scss, _config.scss or the like. Basically, it must be declared before the @import "sassy-gridlover".

Example

Example of Sassy-Gridlover's debug mode

Extras

Styles to make sure everything is aligned.

Outputs extra reset styles.

Parameters

Name Description Type Default value
$sgl-extras Outputs styles to make sure everything is aligned. Boolean false

Declare it in your own _variables.scss, _config.scss or the like. Basically, it must be declared before the @import "sassy-gridlover".

CSS output

html hr,
html .hr {
    border: 1px solid;
    margin: -1px 0;
}

html a,
html b,
html i,
html strong,
html em,
html small,
html code {
    line-height: 0;
}

html sub,
html sup {
    line-height: 0;
    position: relative;
    vertical-align: baseline;
}

html sup {
    top: -0.5em;
}

html sub {
    bottom: -0.25em;
}

Example usage

SCSS

$sgl-debug-mode: false;
// $sgl-debug-mode-max-width: 1024; // Only needed if `$sgl-debug-mode` is `true`.
$sgl-extras: false;

@import "../../sassy-gridlover/sassy-gridlover";

html {
    @include sgl-html;
}

body {
    @include sgl-body;
}

h1 {
    @include sgl-heading(3, 0, 1, 2);
}

h2 {
    @include sgl-heading(2, 0, 1, 1);
}

h3 {
    @include sgl-heading(1, 0, 1, 0);
}

h4 {
    @include sgl-heading(0, 0, 1, 0);
}

h5 {
    @include sgl-heading(0, 0, 1, 0);
}

p,
ul,
ol,
pre,
table,
blockquote {
    @include sgl-margins(0, 1);
}

ul ul,
ol ol,
ul ol,
ol ul {
    @include sgl-margins(0, 0);
}

CSS output

html {
  font-size: 18px;
  line-height: 23px;
}

body {
  font-size: 1em;
  line-height: 1.27778em;
}

h1 {
  font-size: 4.22223em;
  line-height: 1.21053em;
  margin-top: 0.30264em;
  margin-bottom: 0.60527em;
}

h2 {
  font-size: 2.61112em;
  line-height: 1.46809em;
  margin-top: 0.48937em;
  margin-bottom: 0.48937em;
}

h3 {
  font-size: 1.61112em;
  line-height: 1.58621em;
  margin-top: 0.79311em;
  margin-bottom: 0em;
}

h4 {
  font-size: 1em;
  line-height: 1.27778em;
  margin-top: 1.27778em;
  margin-bottom: 0em;
}

h5 {
  font-size: 1em;
  line-height: 1.27778em;
  margin-top: 1.27778em;
  margin-bottom: 0em;
}

p,
ul,
ol,
pre,
table,
blockquote {
  margin-top: 0em;
  margin-bottom: 1.27778em;
}

ul ul,
ol ol,
ul ol,
ol ul {
  margin-top: 0em;
  margin-bottom: 0em;
}

Changelog

See CHANGELOG.

Contributing

See CONTRIBUTING.

Authors

Inspiration and alternatives

  • Gridlover app - The tool to establish a typographic system with modular scale and vertical rhythm on which Sassy-gridlover is based.
  • Knife - Nail vertical rhythm, modular scale, and REMs like a boss with this simple set of SASS/SCSS variables, functions and mixins.
  • gridlover-mixin - A mixin to generate modular scale and vertical rhythm for your typography.

Credits

Thanks to:

License

MIT License.

More Repositories

1

Godot-3-2D-Destructible-Objects

A script that takes a sprite, divides it into blocks and makes them explode ๐Ÿ’ฅ!
GDScript
393
star
2

Godot-3-2D-Day-Night-Cycle

A 2D โ˜€๏ธ Day / ๐ŸŒ” Night cycle using CanvasModulate and a moon light effect using Light2D.
GDScript
329
star
3

Godot-3-2D-CRT-Shader

A 2D shader for Godot 3 simulating a CRT
GLSL
299
star
4

Unofficial-Godot-Engine-Raspberry-Pi

Unofficial Godot Engine binaries for the Raspberry Pi.
281
star
5

RetroPie-Godot-Engine-Emulator

A scriptmodule to install a Godot "emulator" for RetroPie.
Shell
91
star
6

Delaunator-GDScript

A GDScript port of Delaunator: A fast library for Delaunay triangulation of 2D points.
GDScript
80
star
7

GDScriptify

A magical documentation tool for GDScript.
JavaScript
48
star
8

Godot-Plugin-Particles-Renderer

A Godot plugin to render particles into a sprite sheet
GDScript
40
star
9

itchio-godot-scraper

A scraper for Godot games hosted on https://itch.io.
JavaScript
28
star
10

cross-compile-godot-raspberry-pi

A script to easily cross-compile Godot binaries for the Raspberry Pi from Linux x86_64 and an extra script to easily transfer the compiled Godot binaries to the Raspberry Pi using rsync
Shell
28
star
11

aseprite-to-godot-variables

A Lua script to create arrays of colors and indexes of those colors from an Aseprite sprite to be used in Godot.
Lua
23
star
12

Lospec-Palette-List

Browse through thousands of awesome Lospec palettes
GDScript
22
star
13

Murtop-Raspberry-Pi-Bartop-Arcade-Machine-Project

Personal project to create an actual playable Bartop Arcade Machine from scratch using a Raspberry Pi with RetroPie and lots of wood, paint and wires :)
20
star
14

Godot-3-2D-Fake-Explosion-Particles

A script to simulate exploding particles.
GDScript
18
star
15

Godot-3-2D-Fake-Snow-Particles

A script to simulate snow particles โ„๏ธ
GDScript
18
star
16

Godot-3-2D-Fake-Confetti-Particles

A script to simulate confetti particles ๐ŸŽ‰
GDScript
14
star
17

RetroPie-Itchio-Godot-Scraper

A tool for RetroPie to scrape Godot games hosted on https://itch.io.
Shell
12
star
18

RetroPie-Convert-Videos

A tool for RetroPie to convert videos.
Shell
12
star
19

ppa

A PPA repository for my packages (Godot)
Shell
8
star
20

Godot-3-2D-Draw-Sprite

A script to create "sprites" using the _draw() function to easily create patterns, change the color palette, or change the pixel size.
GDScript
8
star
21

es-pixel-theme-extras

Script for RetroPie to install some extras for the EmulationStation's Pixel theme (Retropie menu icons, boot splashscreen and launching images)
Shell
5
star
22

RetroPie-Shell-Script-Boilerplate

A template for building shell scripts for RetroPie.
Shell
4
star
23

RetroPie-Fun-Facts-Splashscreens

A tool for RetroPie to generate splashscreens with random video game related Fun Facts!.
Shell
4
star
24

Godot-2D-Platformer-Test

GDScript
2
star
25

RetroPie-Limit-Last-Played-Games

A tool for RetroPie to limit the number of 'last played' games.
Shell
2
star
26

es-theme-extras

Script for RetroPie to install some extras for EmulationStation themes (icons, splashscreens and launching images)
Shell
1
star
27

Stylus-Mixins

A set of Stylus mixins
CSS
1
star
28

barcelona-bicycle-anchor-points

Find public bicycle anchor points near you in Barcelona!
JavaScript
1
star
29

RetroPie-Extras

A collection of my own scripts for RetroPie
1
star
30

lospec-api

An API for the Lospec Palette List
JavaScript
1
star
31

RetroPie-Murtop

A script to install Murtop on Retropie
Shell
1
star