• Stars
    star
    351
  • Rank 120,906 (Top 3 %)
  • Language
  • Created over 10 years ago
  • Updated almost 9 years ago

Reviews

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

Repository Details

[DEPRECATED] [go to intuitcss/inuitcss] Getting stuck into inuitcss has never been simpler

inuitcss

Getting started

This is the interim documentation for the new inuitcss. Until we get some proper stuff in place, I hope this will see to 90% of questions and issues.

What is inuitcss?

inuitcss is a powerful, Sass-based, BEM, OOCSS framework designed with scalability and performance in mind. It has a tiny footprint (the Starter Kit comes in at 1KB, gzipped), and can be scaled as much or as little as you need.

inuitcss provides a solid architectural foundation upon which you can build any size or style of website or app. inuitcss has been used on single-page marketing sites, medium-sized blogs, to full products for the likes of the NHS. inuitcss is what you make of it—it helps you get started, and then gets out of your way.

inuitcss is a framework in its truest sense. It is not a UI Toolkit, with opinionated views on design; it is not one giant download, with hundreds of unnecessary lines of CSS; it is not a 1001-UI-components-plus-the-kitchen-sink, with loads of bloated rules. It is a collection of tiny, composable, configurable, interdependent modules that you can piece together how you want to, when you want to. inuitcss’ focus is less upon the actual code within it, but upon the principles of a solid, scalable CSS architecture.

Say goodbye to bloated old UI Toolkits and opinionated, monolithic libraries.

Say hello to inuitcss. inuitcss

As quick as possible

The quickest, simplest way to get started with inuitcss is via the Starter Kit. Simply run

$ bower install --save inuit-starter-kit

or use npm for this:

$ npm install --save inuit-starter-kit

…to grab the correct dependencies, and then import them into a bare Sass project in the following order:

@import "bower_components/inuit-defaults/settings.defaults";

@import "bower_components/inuit-functions/tools.functions";
@import "bower_components/inuit-mixins/tools.mixins";

@import "bower_components/inuit-normalize/generic.normalize";
@import "bower_components/inuit-box-sizing/generic.box-sizing";

@import "bower_components/inuit-page/base.page";

This source order is imperative, and underpins the entire inuitcss framework. If you use npm instead, replace bower_components with node_modules.

New to Bower / npm?

If you are new to Bower or npm, but would like to install inuitcss through it, then this is a quick guide to getting up and running:

Install node.js on your system following the website’s instructions. This automatically installs npm for you.

If you want to use Bower in addition, follow the next steps. Otherwise continue from installing the individual modules of inuit.

Install Bower globally (-g).

$ [sudo] npm install -g bower

Initialise Bower in your CSS directory (and follow the command line wizard):

$ cd path/to/your/css/directory
$ bower init

Once you have filled out the interactive wizard, you should now have a new bower.json file in your current (i.e. CSS) directory.

From here on in, running:

$ bower install --save inuit-[module]

…inside the same directory will install the specified module in a bower_components directory, and will save it (--save) to your bower.json.

That really is a very superficial overview; please do be sure to take the time to read up on Bower.

Setting up a project

With inuitcss, you are in charge of almost everything; this includes your master Sass file.

You will need to create your own master Sass file, e.g. main.scss, and @import yours and inuitcss’ modules into that. This kind of architecture allows you to intersperse inuitcss code with your own, whereas most other CSS Frameworks and UI Toolkits only permit you to work before or after you’ve imported them. This is a perfectly valid (example) setup in inuitcss world:

@import "bower_components/inuit-defaults/settings.defaults";
@import "settings.colors";
@import "bower_components/inuit-responsive-settings/settings.responsive";

@import "bower_components/inuit-functions/tools.functions";
@import "bower_components/inuit-mixins/tools.mixins";
@import "bower_components/inuit-responsive-tools/tools.responsive";
@import "tools.aliases";

@import "bower_components/inuit-normalize/generic.normalize";
@import "bower_components/inuit-box-sizing/generic.box-sizing";
@import "bower_components/inuit-shared/generic.shared";

@import "bower_components/inuit-page/base.page";
@import "bower_components/inuit-headings/base.headings";
@import "base.links";
@import "base.quotes";

@import "bower_components/inuit-buttons/objects.buttons";
@import "bower_components/inuit-layout/objects.layout";
@import "bower_components/inuit-media/objects.media";

@import "components.page-head";
@import "components.page-foot";
@import "components.site-nav";
@import "components.ads";
@import "components.promo";

@import "bower_components/inuit-widths/trumps.widths";
@import "bower_components/inuit-spacing/trumps.spacing";

Note how we are interlacing inuitcss code with our own? This is how inuitcss is designed to work. It doesn’t act overly opinionated, and it doesn’t try to do your job for you: you call upon inuitcss when you need it, and do your own thing when you don’t.

Import order

Because inuitcss is broken apart into lots of small, composable modules, it is important that you as the developer piece things together in the correct order. That order is:

  • Settings: Global variables, site-wide settings, config switches, etc.
  • Tools: Site-wide mixins and functions.
  • Generic: Low-specificity, far-reaching rulesets (e.g. resets).
  • Base: Unclassed HTML elements (e.g. a {}, blockquote {}, address {}).
  • Objects: Objects, abstractions, and design patterns (e.g. .media {}).
  • Components: Discrete, complete chunks of UI (e.g. .carousel {}). This is the one layer that inuitcss doesn’t get involved with.
  • Trumps: High-specificity, very explicit selectors. Overrides and helper classes (e.g. .hidden {}).

The order of partials within each layer is fairly open; it is the sections themselves that are important to get in the correct order.

N.B. All partials—including your own—follow the <section>.<file> naming convention, e.g. _objects.box.scss, _components.carousel.scss.

Eventually, this architecture will be written up at itcss.io. Keep an eye on the Twitter account for updates.

Core functionality

There are very few required inuitcss modules, and the ones that are deal only with config and tooling.

Before it can do anything, inuitcss needs to know your base font-size and line-height. These settings are stored in settings.defaults (as $inuit-base-font-size and $inuit-base-line-height), and can be overridden in the same way you’d override any of inuitcss’ config.

Probably the most opinionated thing inuitcss will ever do is reassign your $inuit-base-line-height variable to $inuit-base-spacing-unit. This value then becomes the cornerstone of your UI, acting as the default (remember, you can override everything in inuitcss) margin and padding value for any components that require it.

While this might seem overly opinionated, it does mean that:

  1. You get a free vertical rhythm because everything sits on a multiple of your baseline, and…
  2. We reduce the amount of magic numbers in our codebase because we can rationalise where the majority of values in our CSS came from.

A lot of inuitcss modules will also require tools.functions, which is a very simple file containing only a handful of math helper functions. These are used to quickly create size variants of objects, e.g. padding: double($inuit-base-spacing-unit);.

The other likely piece of required functionality is the tools.mixins module. This contains a simple font-sizing mixin that is used later on in certain type-based modules.

Aside from that, most inuitcss partials have very few interdependencies, and those that do are all dependency managed (if you are using Bower).

Installing new modules

Installing new modules via Bower is simple, just refer to the module’s GitHub repository’s README for the specific command.

Almost all of inuitcss’ modules depend on inuitcss’ default settings and functions. If you are using Bower then you will get these installed automatically. If you are not using Bower, please ensure you have downloaded them manually.

Not using Bower / npm?

That’s cool, you can either install inuitcss dependencies as Git Submodules, or just save the individual files to disk. What is important, however, is that you ensure you have the correct versions of each file (Bower would solve this problem for you automatically), and that you include them in the correct order.

Modifying inuitcss

inuitcss is highly configurable, but should not be edited directly. The correct way to make changes to inuitcss is to pass in variables before you @import the specific file. Let’s take settings.defaults as an example—in this file we can see the variables $inuit-base-font-size and $inuit-base-line-height. If we want to keep these as-is then we needn’t do anything other than @import the file. If we wanted to change these values to 12px and 18px respectively (don’t worry, inuitcss will convert these pixel values to rems for you) then we just need to pass those values in before the @import, thus:

$inuit-base-font-size:   12px;
$inuit-base-line-height: 18px;
@import "bower_components/inuit-defaults/settings.defaults";

The same goes for any inuitcss module: you can configure it by predefining any of its variables immediately before the @import:

$inuit-btn-background:      #BADA55;
$inuit-btn-radius:          3px;
$inuit-enable-btn--full:    true;
@import "bower_components/inuit-buttons/objects.buttons";

$inuit-enable-layout--middle:   true;
@import "bower_components/inuit-layout/objects.layout";

@import "bower_components/inuit-media/objects.media";

$inuit-enable-flag--rev:        true;
$inuit-enable-flag--responsive: true;
@import "bower_components/inuit-flag/objects.flag";

You could also chunk your inuitcss overrides into their own file, settings.inuitcss, for example. Again, this (as with all inuitcss overrides) needs @importing before the inuitcss partial to which it relates.

This method of modifying the framework means that you don’t need to edit any files directly (thus making it easier to update the framework), but also means that you’re not left with huge, bloated, monolithic variables files from which you need to configure an entire library.

Off by default

In the interests of reducing the amount of code in your project, all of inuitcss’ module-variants are turned off by default. This gives inuitcss two layers of reduced bloat:

  1. You only include the specific files you need, so you’re immediately starting with a very trimmed down codebase.
  2. Any variants are switched off by default, so if you just want buttons, you don’t get every different size and permutation of them unless you explicitly tell inuitcss you want them.

To turn features on, just set their switches to true (again, before you @import the file):

$inuit-enable-btn--full:    true;
$inuit-enable-btn--large:   true;
@import "bower_components/inuit-buttons/objects.buttons";

Extending inuitcss

Two things about inuitcss make it very extensible. Firstly, it is a framework in its truest sense; it is designed to lay an unopinionated foundation upon which you do the majority of the work. Secondly, scalability is one of inuitcss’ core principles, so it is designed to get larger over time.

Extending inuitcss is made very simple because of its very decoupled nature. As opposed to having a monolithic framework which acts as one giant black box, you can add your own functionality in and around inuitcss code. This means that you can grow your codebase in any direction from any point. inuitcss has some default tooling, but there’s no reason you cannot create your own tools partials, there is no reason why you couldn’t add some of your own objects that inuitcss doesn’t have.

To extend inuitcss, simply create a partial in the <section>.<file> format, and @import it wherever it is needed.

As you can see in inuitcss’ implementation on my own site, I have @imported the default inuitcss base.page module, and also added one of my own to extend the default module’s functionality.

inuitcss is not designed to do your work for you, it is designed to help you do your own work faster.

Aliases

In order to avoid clashes with your own code, all of inuitcss’ mixins and variables are namespaced with inuit-, for example: $inuit-base-spacing-unit. These variables and mixins can become very tedious and time consuming to type over and over, so it is recommended that you alias them to something a little shorter. You can do this by creating a tools.aliases file (_tools.aliases.scss) which would be populated with code like this:

// Reassign `$inuit-base-spacing-unit` to `$spacing-unit`.
$spacing-unit: $inuit-base-spacing-unit;

// Reassign lengthy font-size mixin to `font-size()`.
@mixin font-size($args...) {
    @include inuit-font-size($args...);
}

You can now use your own aliases onto inuitcss’ defaults throughout your project.

Components

inuitcss is a design-free, OOCSS framework—it does its best to provide zero cosmetic styling. This means that inuitcss can be used on any and all types of project (and it has been) without dictating (or even suggesting) a look-and-feel. If you do require a UI out of the box, then inuitcss is probably not the best tool for you. I’d recommend looking at a UI Toolkit such as Bootstrap.

Because inuitcss does no cosmetic styling, it is up to you to author the Components layer. Components are small partials that contain discrete chunks of UI that utilise the layers that came before it, for example, a carousel, or a dropdown nav, or an image gallery, and so on.

Namespacing

inuitcss is designed for use on larger projects, where namespacing can often be very useful. With this in mind, inuitcss contains two ways in which you can namespace its modules: globally, or on a per-component basis.

Global namespacing

If you want the entire framework to carry a namespace, you simply need to predefine the $inuit-namespace variable held in settings.defaults, like so:

$inuit-namespace: inuitcss-;
@import "bower_components/inuit-defaults/settings.defaults";

Now every class in every module that inuitcss imports will be prepended with inuitcss-, e.g. .flag now becomes .inuitcss-flag. This allows you to visually denote which classes are your own, and which are inuitcss’, and also helps reduce the chance of collisions.

Module namespacing

If you do not wish to set a global namespace, you can set namespaces on individual @imports, e.g.:

$inuit-flag-namespace: foo-;
@import "bower_components/inuit-flag/objects.flag";

Now the flag object’s class is .foo-flag, but the rest of inuitcss remains un-namespaced.

Combining the two

You can have a combination of global and per-component namespacing in a project:

$inuit-namespace: inuitcss-;
@import "bower_components/inuit-defaults/settings.defaults";

...

$inuit-flag-namespace: foo-;
@import "bower_components/inuit-flag/objects.flag";

Now all of your inuitcss modules will have a prefix of inuitcss-, except the flag object, whose namespace is foo-.

Learn by example

My site, CSS Wizardry, is built upon inuitcss. View the source code to see how things piece together, and hopefully reverse engineer things from there: github.com/…/csswizardry.github.com/…/css

More Repositories

1

inuitcss

Extensible, scalable, Sass-based, OOCSS framework for large and long-lasting UI projects.
SCSS
1,854
star
2

starter-kit

[DEPRECATED] [go to intuitcss/inuitcss] A simple, stripped back starter kit for inuitcss projects
74
star
3

template

A default template for inuitcss compatible Sass files
CSS
35
star
4

objects.layout

[DEPRECATED] [go to intuitcss/inuitcss] inuitcss’ answer to the traditional grid system
CSS
30
star
5

generic.normalize

@necolas’ normalize.css.
CSS
27
star
6

inuitcss.github.io

The inuitcss website.
HTML
26
star
7

objects.media

[DEPRECATED] [go to intuitcss/inuitcss] @stubbornella’s media object
CSS
20
star
8

trumps.spacing

[DEPRECATED] [go to intuitcss/inuitcss] Spacing helper classes
CSS
17
star
9

objects.buttons

[DEPRECATED] [go to intuitcss/inuitcss] Simple, extensible button objects
CSS
16
star
10

trumps.clearfix

[DEPRECATED] [go to intuitcss/inuitcss] Simple clearfix helper
CSS
14
star
11

dev-test

[DEPRECATED] [go to intuitcss/inuitcss] A simple, hacky, dev/test file to build inuitcss modules into
CSS
14
star
12

settings.defaults

[DEPRECATED] [go to intuitcss/inuitcss] inuitcss’ default settings
CSS
14
star
13

base.page

[DEPRECATED] [go to intuitcss/inuitcss] Base page-level styling.
CSS
13
star
14

trumps.spacing-responsive

[DEPRECATED] [go to intuitcss/inuitcss]
CSS
12
star
15

generic.reset

[DEPRECATED] [go to intuitcss/inuitcss] Basic reset to complement normalize.css.
CSS
12
star
16

objects.flag

[DEPRECATED] [go to intuitcss/inuitcss] The flag object
CSS
12
star
17

tools.mixins

[DEPRECATED] [go to intuitcss/inuitcss] inuitcss’ default mixins
CSS
11
star
18

CONTRIBUTING

[DEPRECATED] [go to intuitcss/inuitcss]
11
star
19

tools.widths

[DEPRECATED] [go to intuitcss/inuitcss] inuitcss width classes generator
CSS
10
star
20

objects.list-bare

[DEPRECATED] [go to intuitcss/inuitcss] A simple object to remove bullets and indents from lists
CSS
10
star
21

tools.responsive

[DEPRECATED] [go to intuitcss/inuitcss]
CSS
9
star
22

objects.tables

[DEPRECATED] [go to intuitcss/inuitcss] Basic table styles.
CSS
9
star
23

trumps.widths-responsive

[DEPRECATED] [go to intuitcss/inuitcss]
CSS
9
star
24

trumps.widths

[DEPRECATED] [go to intuitcss/inuitcss] A series of helper classes for dealing with widths
CSS
9
star
25

objects.pack

[DEPRECATED] [go to intuitcss/inuitcss] Cause items to pack up to automatically fill their parent.
CSS
8
star
26

tools.functions

[DEPRECATED] [go to intuitcss/inuitcss] inuitcss’ default functions
CSS
8
star
27

objects.box

[DEPRECATED] [go to intuitcss/inuitcss] Simple object to make boxed-off content.
CSS
8
star
28

generic.box-sizing

[DEPRECATED] [go to intuitcss/inuitcss] Global box-sizing options.
CSS
7
star
29

generic.shared

[DEPRECATED] [go to intuitcss/inuitcss] High-level styling across shared rulesets
CSS
7
star
30

objects.list-block

[DEPRECATED] [go to intuitcss/inuitcss] A simple, blocky list object.
CSS
7
star
31

base.paragraphs

[DEPRECATED] [go to intuitcss/inuitcss] Simple paragraph styles
CSS
6
star
32

objects.list-inline

[DEPRECATED] [go to intuitcss/inuitcss]
CSS
6
star
33

settings.responsive

[DEPRECATED] [go to intuitcss/inuitcss]
CSS
6
star
34

objects.tabs

[DEPRECATED] [go to intuitcss/inuitcss] Simple tabs abstraction.
CSS
6
star
35

objects.list-ui

[DEPRECATED] [go to intuitcss/inuitcss] A simple, keyline-delimited blocky list object.
CSS
6
star
36

base.images

[DEPRECATED] [go to intuitcss/inuitcss] Simple image styles
CSS
6
star
37

base.lists

[DEPRECATED] [go to intuitcss/inuitcss] Simple list styles
CSS
5
star
38

base.headings

[DEPRECATED] [go to intuitcss/inuitcss] Base-level heading styles.
CSS
5
star
39

objects.block

[DEPRECATED] [go to intuitcss/inuitcss] Stack an image above some text content.
CSS
5
star
40

trumps.print

[DEPRECATED] [go to intuitcss/inuitcss]
CSS
4
star
41

LICENSE

All-encompassing license for inuitcss’ code
3
star