GithubHelp home page GithubHelp logo

jasonbellamy / gridgraphy Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 268 KB

Gridgraphy is a highly configurable, and incredibly flexible Sass plugin that enables you to quickly and easily build semantic CSS grids.

License: MIT License

CSS 100.00%

gridgraphy's Introduction

Gridgraphy

Gridgraphy is a highly configurable sass plugin that enables you to quickly and easily build semantic CSS grids.

Getting Started

  1. Install Gridgraphy by copying the contents of the lib to your project.
  2. Import the Grigraphy plugin in to your stylesheets.
@import gridgraphy

Configurable Variables

You can mix and match different configurations to acheive the exact type of grid you need.

  • $grid-type [default: full] - The type of grid. [full, right, center, left]
  • $grid-gutter-type [default: margin] - The type of spacing to use for a columns gutter. [margin, padding]
  • $grid-max-width [default: 960px] - The maximum width of the grid in px.
  • $grid-gutter-width [default: 20px] - The gutter spacing in px between columns.
  • $grid-column-count [default: 12] - The total number of columns in the grid.
  • $grid-show [default: false] - Set true to highlight the grid row & columns.

That's it! You now have access to all of the mixins and functions that Gridgraphy provides.


Scaffolding

Scaffolding is a quick way to generate classes for a grid. If you plan on adding your grid classes directly to your markup or want to export a pre-made grid as part of an external library, scaffolding can save you a ton of time.

You can add scaffolding to an existing project by adding the following line to any of your Sass/SCSS stylesheet(s):

@import gridgraphy/scaffolding

Configurable Variables

  • $grid-namespace-base [default: grid] - The name of the prefix that will be used for the grids row & columns class.
  • $grid-namespace-row [default: row] - The name of the suffix that will be used for the grids row class.
  • $grid-namespace-column [default: column] - The name of the suffix that will be used for the grids column class.

Types

Gridgraphy ships with 4 different types of layouts. By default grids are created using the value you've set for the $grid-type configuration variable, but can be set manually on each grid-* mixin or function.

  • Full - The full grid type does not have a gutter between columns.
  • Right - The right grid type has its gutter distributed to the right side of each column.
  • Center - The center grid type has its gutter split in half and evenly distributed to both sides of each column.
  • Left - The left grid type has its gutter distributed the the left side of each column.

Mixins

grid-row($max-width)

Sets an element as the container for your columns.

  • $max-width [default: $grid-max-width] - The maximum width in pixels the row should span.
.grid-row
    @include grid-row(960px)

grid-row-nested($type)

Sets an element as the container for your columns inside another column.

  • $type [default: $grid-type] - The type of grid to be used.
.grid-row
    @include grid-row-nested(left)

grid-column($columns, $type)

Sets all the properties of a column.

  • $columns - The number of columns to span in the row.
  • $type [default: $grid-type] - The type of grid to be used.
.grid-column
    @include grid-column(6)

grid-column-width($columns, $type)

Set only the width of a column.

Note: This mixin is called automatically when using the grid-column() mixin. You'll probably only want to use this directly if you need to keep your selectors very DRY.

  • $columns - The number of columns to span in the row.
  • $type [default: $grid-type] - The type of grid to be used.
.grid-column
    @include grid-column-width(6)

grid-column-base()

Set only the base properties of a column.

Note: This mixin is called automatically when using the grid-column() mixin. You'll probably only want to use this directly if you need to keep your selectors very DRY.

[class^="grid-column-"]
  @include grid-column-base()

.grid-column-1
    @include grid-column-gutter(4)

.grid-column-2
    @include grid-column-gutter(8)

grid-column-gutter($columns, $type)

Set only the gutter properties of a column.

Note: This mixin is called automatically when using the grid-column() mixin. You'll probably only want to use this directly if you need to keep your selectors very DRY.

  • $columns - The number of columns to span in the row.
  • $type [default: $grid-type] - The type of grid to be used.
.grid-column
    @include grid-column-gutter(6)

grid-column-offset-right($columns, $type)

Sets all the properties to offset the column from the right. (prepends empty columns)

  • $columns - The number of columns to offset by.
  • $type [default: $grid-type] - The type of grid to be used.
.grid-column
    @include grid-column-offest-right(6)

grid-column-offset-left($columns, $type)

Sets all the properties to offset the column from the left. (appends empty columns)

  • $columns - The number of columns to offset by.
  • $type [default: $grid-type] - The type of grid to be used.
.grid-column
    @include grid-column-offest-left(6)

grid-column-push($columns, $type)

Sets all the properties to push the column from the left. (moves the column without affecting surrounding elements)

  • $columns - The number of columns to push by.
  • $type [default: $grid-type] - The type of grid to be used.
.grid-column
    @include grid-column-push(6)

grid-column-pull($columns, $type)

Sets all the properties to pull the column towards the left. (moves the column without affecting surrounding elements)

  • $columns - The number of columns to pull by.
  • $type [default: $grid-type] - The type of grid to be used.
.grid-column
    @include grid-column-pull(6)

Functions

grid-column-width($columns, $type)

Returns the unitless (percentage based) width of a column.

  • $columns - The number of columns to take up in a row.
  • $type [default: $grid-type] - The type of grid to be used.
.grid-column
  width: #{grid-column-width(12)}%

grid-column-offset($columns, $type)

Returns the unitless (percentage based) offset width of a column.

  • $columns - The number of columns to offset by.
  • $type [default: $grid-type] - The type of grid to be used.
.grid-column
  left: #{grid-column-offset(12)}%

grid-column-gutter($columns, $type)

Returns the unitless (percentage based) gutter width of a column.

  • $columns - The number of columns to span in the row.
  • $type [default: $grid-type] - The type of grid to be used.
.grid-column
  margin-left: #{grid-column-gutter(12)}%

Contributing

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality.

License

Copyright (c) 2015 Jason Bellamy
Licensed under the MIT license.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.