mini.css/docs/customization.html

187 lines
17 KiB
HTML
Raw Normal View History

2016-12-15 22:10:45 +00:00
<!DOCTYPE html>
2017-02-07 10:23:53 +00:00
<html lang="en">
2016-12-15 22:10:45 +00:00
<head>
2017-02-07 10:23:53 +00:00
<link rel="stylesheet" href="https://cdn.rawgit.com/Chalarangelo/mini.css/v2.1.0/dist/mini-default.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
<title>mini.css - Customization</title>
<meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1">
<meta name="description" content="mini.css - Minimal, responsive, style-agnostic CSS framework">
<meta name="keywords" content="mini, mini.css, CSS, framework, minimal, responsive, style-agnostic, front-end, frontend, Sass, customization, flavor ">
<meta name="author" content="Angelos Chalaris (chalarangelo)">
<meta property="og:title" content="mini.css - Minimal, responsive, style-agnostic CSS framework">
<meta property="og:description" content="mini.css is a tiny CSS framework designed to build quick, modern and responsive websites."/>
<meta property="og:type" content="website"/><meta property="og:image" content="page_thumb.PNG">
<meta property="og:url" content="https://chalarangelo.github.io/mini.css/"><link rel="icon" type="image/png" href="favicon.png">
<style>
#header-logo { display: inline; height: 28px; width: 28px; margin-top: 4px; background: #558b2f; border-radius: 1px; padding: 4px; }
.box-centered { text-align: center; } .box-colored { background: #0277bd; border-radius: 2px; padding: 14px; margin-bottom: 8px; min-height: 14px;}
.box-colored.red { background: #e53935; } .box-centered > .card.fluid {-webkit-box-pack: start; -webkit-box-align: start; -webkit-justify-content: flex-start; justify-content: flex-start; -webkit-align-self: auto; align-self: auto; } [class^='col-'] .card.fluid { margin: 2px 0 20px; } .box-left { text-align: left; }
[class^='fore-'] { font-family: monospace, monospace;} .fore-primary { color: #0d47a1;} .fore-secondary { color: #b71c1c;} .fore-tertiary { color: #1b5e20;}
</style>
2016-12-15 22:10:45 +00:00
</head>
2017-02-02 22:27:22 +00:00
<body>
2017-02-07 10:23:53 +00:00
<header class="sticky">
<a href="index.html" class="logo"><img src="mini-logo.svg" id="header-logo">&nbsp;<span style="vertical-align: top; position: relative; top:-12px;"><span style="font-size: 1.35em;">m</span>ini<span style="font-size:0.65em; color: #558b2f;">.css</span></span></a>
<div style="display: inline; overflow: auto;">
<a href="index.html" class="button">Introduction</a> <a href="modules.html" class="button">Modules</a>
<a href="flavors.html" class="button">Flavors</a> <a href="customization.html" class="button">Customization</a>
<a href="quick_reference.html" class="button">Quick Reference</a>
<a href="https://github.com/Chalarangelo/mini.css" class="button"><i class="fa fa-github" aria-hidden="true" style="font-size: 1.4em; position: relative; bottom: -2px; margin-right: 2px;"></i>&nbsp;Github</a>
</div>
</header>
2016-12-15 22:10:45 +00:00
<!-- Insert your page content here-->
<main><div class="container">
<div class="row" style="padding-top: 40px;">
<div class="col-sm">
<h1>Customization</h1>
<p><strong>mini.css</strong> is built in such a way that customizing it is really simple. You can try out one of the <a href="flavors.html">pre-defined flavors</a>, if you want to start learning and build something quickly. We strongly suggest, however, that you customize an existing flavor or build your own, by tweaking variables and using mixins, in order to create your own, unique style. In this page, we will try to give you some guidelines and tips on how to do so and explain a few more things about the inner workings of <strong>mini.css</strong>.</p><br>
<h2>Introduction &amp; basics</h2>
<p><strong>mini.css</strong> is written using <a href="http://sass-lang.com/">Sass</a>, a very popular CSS preprocessor. We use Sass to do four things:</p>
<ul>
<li>Make the code modular</li>
<li>Create variables that can be changed on the fly</li>
<li>Optimize the code</li>
<li>Create reusable mixins</li>
</ul>
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-6">
<h3>Modules &amp; file structure</h3>
<p>At the heart of <strong>mini.css</strong> are modules - groups of classes and styles that aim to solve one set of needs. There are 10 modules in <strong>mini.css</strong>, which have been already written for you. All of the modules are built using partial files, named <code>_module_name.scss</code> and placed in the <code>src/mini</code> folder. You can edit any of the modules' code and/or add your own modules, following the same structure. The only thing you need to remember to do, in order to add your module to your flavor, is to add an <code>@import</code> statement after all the required variable declarations towards the bottom of your flavor file and it will be compiled along with the rest of <strong>mini.css</strong>. Similarly, to disable a module, just comment out its <code>@import</code> statement from the flavor file.</p>
2016-12-15 22:10:45 +00:00
</div>
<div class="col-sm-12 col-md-6">
<h3>Variables</h3>
<p>Everything in <strong>mini.css</strong> is based on Sass variables. We try to make our variable names as descriptive as possible, usually using names like <code>$block-element-property-name</code>, but some things might vary a little bit. Changing the values of variables should be reasonably easy, simply navigate to the <code>src/flavors/flavor-name.scss</code> file for a pre-defined flavor and you will see a list of variables that you can tweak. Change the values as you see fit and your finalized stylesheet will reflect the changes you have made. We did our best to make everything as customizable as possible, so that different people can build entirely different flavors using the same building blocks.</p>
</div>
</div>
<div class="row">
<div class="col-sm-12 col-md-6">
<h3>Code optimization</h3>
2016-12-19 21:28:23 +00:00
<p>Building <strong>mini.css</strong> was no small task. Making it lightweight and customizable made things even harder, because these two things don't go well together most of the time. What we did was put more of the load on the preprocessor, instead of the final file. In order to accomplish this, we optimized as much of the code as possible, using conditions, flags and other tricks, so that compiling a flavor file might take one second longer, but loading won't. If you add any code to a flavor yourself, remember not only to make it customizable, but also to optimize it as best as possible.</p>
2016-12-15 22:10:45 +00:00
</div>
<div class="col-sm-12 col-md-6">
<h3>Mixins</h3>
2016-12-19 21:28:23 +00:00
<p>A lot of elements and components can be styled in many ways and most of the time we want a few styles to be available, without having to rewrite everything. We utilized the <code>@mixin</code> directive of Sass wherever we could to make it possible for you to easily create styles for pre-existing components and elements without having to tweak the base code for said elements or components. To use a mixin, simply <code>@include</code> it, passing values to at least its mandatory parameters. We recommend you write mixins wherever possible, if you create any new modules for <strong>mini.css</strong>.</p>
2016-12-15 22:10:45 +00:00
</div>
</div>
<div class="row">
<div class="col-sm-12">
<br>
<h2>Building a flavor</h2>
<p>Creating your own flavor can be as easy or as complicated as your needs. Adding and removing modules is as simple as adding an <code>@import</code> statement or commenting it out, after declaring all the required variables. In this section, we will briefly walk you through most of the variables usually present in a flavor, along with some flags and mixins. This section serves as a complementary documentation to the comment column present in our pre-defined flavors, instead of a replacement and should be always viewed alongside it.</p><br>
2016-12-15 22:30:40 +00:00
<div class="card fluid">
2017-02-07 10:23:53 +00:00
<div class="section"><h3>Core</h3></div>
2016-12-15 22:30:40 +00:00
<div class="section">
<p>The <strong>core</strong> module uses a lot of variables, most of which are pretty straightforward. Some of the most important ones are as follows:</p>
<ul>
<li><code>$fore-color</code> - base text color</li>
<li><code>$back-color</code> - base background color or image</li>
<li><code>$base-font-family</code> - font stack</li>
<li><code>$base-root-font-size</code> - font size of the page's root element, <strong>must be specified in <mark>px</mark> units</strong></li>
<li><code>$base-line-height</code> - base line height for the page's text</li>
<li><code>$body-margin</code> - margin of the <code>&lt;body&gt;</code> element</li>
</ul>
<p>Apart from the above variables, you should take note of the boolean <code>$apply-defaults-to-all</code>, which will reset font styling for all elements, utilizing the value of <code>$base-font-size</code> in the process. Certain elements like headings, horizontal rules and code blocks have some opinionated &quot;modern&quot; styles which can be turned on or off, using the boolean variables <code>$make-heading-smalltext-block</code>, <code>$horizontal-rule-fancy-style</code> and <code>$add-pre-element-sidebar</code>. The <code>$style-samp-element</code> and <code>$include-dfn-fix</code> boolean variables will either add styling for the elements they affect or completely omit it. This is part of the code optimization process, as most websites rarely use these elements. Finally, there are two boolean variables for link styling, <code>$apply-link-underline</code> and <code>$apply-link-hover-fade</code>.</p>
</div>
</div>
<div class="card fluid">
2017-02-07 10:23:53 +00:00
<div class="section"><h3>Grid</h3></div>
2016-12-15 22:30:40 +00:00
<div class="section">
2016-12-19 21:28:23 +00:00
<p>The <strong>grid</strong> module contains two important variables, the boolean <code>$use-four-step-grid</code> which determines if the grid has 3 or 4 breakpoints and the <code>$grid-column-count</code> which determines the amount of vertical columns used for the grid's layout. Apart from those, there are a few variables that set the names for the grid system's classes, prefixes and suffixes and the grid's screen size breakpoint definitions.</p>
2016-12-15 22:30:40 +00:00
</div>
</div>
<div class="card fluid">
2017-02-07 10:23:53 +00:00
<div class="section"><h3>Navigation</h3></div>
2016-12-15 22:30:40 +00:00
<div class="section">
2016-12-19 21:28:23 +00:00
<p>The <strong>navigation</strong> module contains a plethora of variables used in the styling of the navigational elements. Most of them concern colors, spacing and sizing or similar things. Bear in mind that the presentation of buttons inside the <code>&lt;header&gt;</code> element will be affected by the styling of all button elements, as defined in the <code>input_control</code> module. The variable that stands out in this module is <code>$nav-sublink-depth</code> which determines how deep a navigational hierarchy tree can be.</p>
2016-12-15 22:30:40 +00:00
</div>
</div>
<div class="card fluid">
2017-02-07 10:23:53 +00:00
<div class="section"><h3>Input Control</h3></div>
2016-12-15 22:30:40 +00:00
<div class="section">
2016-12-15 23:13:14 +00:00
<p>The <strong>input_control</strong> module is one of the larger modules, containg a lot of variables to style a multitude of elements. Forms and textual <code>&lt;input&gt;</code> elements utilize variables that concern color, spacing, sizing etc. Button variables are more interesting, especially the ones concerning the opacity of button elements (<code>$button-back-opacity</code> and <code>$button-hover-back-opacity</code>). The <code>$hide-file-inputs</code> boolean variable determines how <code>&lt;input <span class="fore-secondary">type</span>=<span class="fore-primary">&quot;file&quot;</span>&gt;</code> elements will be handled. Checkboxes and radio buttons also use a few variables concerning basic styling, but special attention needs to be paid to the <code>$checkbox-size</code> variable, as it determines a few attributes of both elements.</p>
<p>There are two mixins in the <strong>input_control</strong> module, specifically:</p>
<ul>
<li><code>make-button-alt-color</code> - button color variants</li>
<li><code>make-button-alt-style</code> - button size and spacing variants</li>
</ul>
2016-12-15 22:30:40 +00:00
</div>
</div>
<div class="card fluid">
2017-02-07 10:23:53 +00:00
<div class="section"><h3>Table</h3></div>
2016-12-15 22:30:40 +00:00
<div class="section">
2016-12-15 23:13:14 +00:00
<p>The <strong>table</strong> module's variables deal mostly with basic table styling. The <code>$table-mobile-breakpoint</code> is very important as it determines the breakpoint for responsive tables' mobile view, along with <code>$table-mobile-card-label</code> which determines the attribute that will be used to display the table headings on mobile devices.</p>
2016-12-15 22:30:40 +00:00
</div>
</div>
<div class="card fluid">
2017-02-07 10:23:53 +00:00
<div class="section"><h3>Card</h3></div>
2016-12-15 22:30:40 +00:00
<div class="section">
2016-12-15 23:13:14 +00:00
<p>The <strong>card</strong> modules' variables mostly deal with things like class names, spacing, sizing and colors. Cards offer a handful of mixins, specifically:</p>
<ul>
<li><code>make-card-alt-size</code> - card size variants</li>
<li><code>make-card-alt-color</code> - card color variants</li>
<li><code>make-card-section-alt-color</code> - card section color variants</li>
<li><code>make-card-section-alt-style</code> - card section size and spacing variants</li>
</ul>
2016-12-15 22:30:40 +00:00
</div>
</div>
<div class="card fluid">
2017-02-07 10:23:53 +00:00
<div class="section"><h3>Tab</h3></div>
2016-12-15 22:30:40 +00:00
<div class="section">
2016-12-15 23:13:14 +00:00
<p>The <strong>tab</strong> module utilizes a few naming and color variables, along with some sizing and spacing variables to deal with presentation and functionality. Many of the sizing variables are very dependent on each other's values. The <code>$tab-stacked-breakpoint</code> variable is especially important, as it determines the mobile view breakpoint for the tabs component.</p>
2016-12-15 22:30:40 +00:00
</div>
</div>
<div class="card fluid">
2017-02-07 10:23:53 +00:00
<div class="section"><h3>Contextual</h3></div>
2016-12-15 22:30:40 +00:00
<div class="section">
2016-12-19 21:28:23 +00:00
<p>The <strong>contextual</strong> module features, apart from basic naming and styling variables, a few things of note. The boolean variable <code>$alert-include-animated</code> determines if animated alerts will be inluded or not. There is also a handful of mixins, which are the most important part of the contextual module as they are what makes it useful:</p>
2016-12-15 23:13:14 +00:00
<ul>
<li><code>make-mark-alt-color</code> - mark color variants</li>
<li><code>make-mark-alt-style</code> - mark size and spacing variants</li>
<li><code>make-alert-alt-color</code> - alert color variants</li>
<li><code>make-alert-alt-style</code> - alert size and spacing variants</li>
</ul>
2016-12-15 22:30:40 +00:00
</div>
</div>
<div class="card fluid">
2017-02-07 10:23:53 +00:00
<div class="section"><h3>Progress</h3></div>
2016-12-15 22:30:40 +00:00
<div class="section">
2016-12-15 23:13:14 +00:00
<p>The <strong>progress</strong> module contains lots of variables that affect basic styling, but it also features a few interesting mixins:</p>
<ul>
<li><code>make-progress-inline</code> - inline progress variant</li>
<li><code>make-progress-alt-color</code> - progress color variants</li>
<li><code>make-progress-alt-style</code> - progress size and spacing variants</li>
<li><code>make-spinner-donut-alt-color</code> - spinner donut color variants</li>
2016-12-19 21:28:23 +00:00
<li><code>make-spinner-donut-alt-style</code> - spinner donut size and spacing variants</li>
2016-12-15 23:13:14 +00:00
</ul>
2016-12-15 22:30:40 +00:00
</div>
</div>
<div class="card fluid">
2017-02-07 10:23:53 +00:00
<div class="section"><h3>Utility</h3></div>
2016-12-15 22:30:40 +00:00
<div class="section">
2016-12-15 23:13:14 +00:00
<p>The <strong>utility</strong> module contains a few variables dealing with naming and basic styling, but its most important feature is its mixins:</p>
<ul>
<li><code>make-border-generic</code> - generic border</li>
<li><code>make-border-radial-style</code> - border radius variants</li>
<li><code>make-box-shadow-generic</code> - generic shadow variants</li>
<li><code>make-margin-responsive</code> - responsive margins</li>
<li><code>make-padding-responsive</code> - responsive paddings</li>
<li><code>make-floats</code> - quick floats</li>
</ul>
2016-12-15 22:30:40 +00:00
</div>
</div>
2016-12-15 22:10:45 +00:00
</div>
</div>
2016-12-15 23:13:14 +00:00
<div class="row">
<div class="col-sm">
<p>If you would rather use one of the pre-defined flavors, check out our <a href="flavors.html">flavors</a> page for a list of all flavors currently available.</p>
</div>
</div>
2017-02-07 10:23:53 +00:00
<div class="row box-centered"><div class="col-sm-12"></div></div>
2016-12-15 22:10:45 +00:00
</div></main>
<!-- End of page content-->
2017-01-08 16:40:56 +00:00
<footer><strong>mini.css</strong> was designed and built with <i class="fa fa-heart-o" aria-hidden="true"></i> by <a href="https://github.com/Chalarangelo">@Chalarangelo</a>. It is licensed under the <a href="https://github.com/Chalarangelo/mini.css/blob/master/LICENSE">MIT License</a>. You can view the project's source code on <a href="https://github.com/Chalarangelo/mini.css">Github</a>.</footer>
2016-12-15 22:10:45 +00:00
</body>
2017-02-02 22:27:22 +00:00
</html>