Giter Club home page Giter Club logo

emma.css's Introduction

Emma.css { emmet-like utility classes }

A collection of CSS utility classes for rapid front-end development.

Example

Emma.css only:

<article class="u-cf">
  <img class="u-d-b u-fl-l u-w-a u-mr-xl u-bdrs-3" src="foo.png">
  <div class="u-fl-l u-ml-lg u-p-md">
    <h1 class="u-m-0 u-ff-t">Title</h1>
    <p class="u-wow-bw u-wfsm-a">Description</p>
    <a class="u-d-ib u-fz-sm u-lh-2" href="#">Read more</a>
  </div>
</article>

SUIT CSS naming convention + Emma.css:

<article class="Excerpt u-cf">
  <img class="Excerpt-thumbnail u-d-b u-fl-l u-w-a" src="foo.png">
  <div class="u-fl-l u-ml-lg u-p-md">
    <h1 class="Excerpt-title">Title</h1>
    <p class="u-wow-bw u-wfsm-a">Description</p>
    <a class="Excerpt-readMore" href="#">Read more</a>
  </div>
</article>
utility class name declaration
.u-cf (clearfix) micro clearfix hack
.u-d-b display: block;
.u-fl-l float: left;
.u-w-a width: auto;
.u-mr-xl (extra large) margin-right: 4.0rem;
.u-bdrs-3 border-radius: 3px;
.u-ml-lg (large) margin-left: 2.0rem;
.u-p-md (medium) padding: 1.0rem;
.u-m-0 margin: 0;
.u-ff-t font-family: "Times New Roman", Times, Baskerville, Georgia, serif;
.u-wow-bw word-wrap: break-word;
.u-wfsm-a -webkit-font-smoothing: antialiased;
.u-d-ib display: inline-block;
.u-fz-sm (small) font-size: small;
.u-lh-2 line-height: 2;

See also: emma.css (all utility classes)

Getting Started

Installation

Install or download Emma.css from one of these sources:

Basic usage

SCSS:

@import "path/to/emma.scss";

CSS output:

.u-pos-s { position: static !important; }
.u-pos-a { position: absolute !important; }
.u-pos-r { position: relative !important; }
(snip)

Change prefix of utility classes

Default prefix: u-
You can change prefix of utility classes by $emma-prefix variable:

$emma-prefix: "foo-"; // Change prefix
@import "path/to/emma.scss";

CSS output:

.foo-pos-s { position: static !important; }
.foo-pos-a { position: absolute !important; }
.foo-pos-r { position: relative !important; }
(snip)

If you need to remove prefix:

$emma-prefix: ""; // Remove prefix
@import "path/to/emma.scss";

CSS output:

.pos-s { position: static !important; }
.pos-a { position: absolute !important; }
.pos-r { position: relative !important; }
(snip)

Remove !important decralations

You can remove !important decralations by $emma-important variable:

$emma-important: false; // Remove !important decralations
@import "path/to/emma.scss";

CSS output:

.u-pos-s { position: static; }
.u-pos-a { position: absolute; }
.u-pos-r { position: relative; }
(snip)

Select available snippets

You can select available snippets by $emma-available-snippet-list variable:

$emma-available-snippet-list: (
  tt-u, ff-a, wfsm-a, cf, // Select available snippets
);
@import "path/to/emma.scss";

CSS output:

.u-tt-u { text-transform: uppercase !important; }
.u-ff-a { font-family: Arial, "Helvetica Neue", Helvetica, sans-serif !important; }
.u-wfsm-a { -webkit-font-smoothing: antialiased !important; }
.u-cf:before, .u-cf:after { content: " "; display: table; }
.u-cf:after { clear: both; }

Change default sizes or colors

You can change default sizes or colors by variables:

$emma-padding-md: 20px;     // default: 1.0rem
$emma-color-black: #111111; // default: black
@import "path/to/emma.scss";

If you need to change nicer color palette:

$emma-alternative-colors: true;
@import "path/to/emma.scss";

Define custom snippets

You can define custom snippets by emma mixin:

@import "path/to/emma.scss";
@include emma(foo-bar, color, #369); // Single declaration
@include emma(baz) {                 // Multiple declaration
  font-size: 2.1em !important;
  line-height: 1.618;
}

CSS output:

(snip)
.u-foo-bar { color: #369 !important; }
.u-baz { font-size: 2.1em !important; line-height: 1.618; }

Inspired by

License

Released under the MIT license.

Author

ruedap

emma.css's People

Contributors

ruedap avatar

Watchers

James Cloos avatar Hibiki Kudo avatar  avatar

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.