‼️ This repository is not maintained. Do not use it.
Scssfold is a small utility-first CSS framework. Its purpose is to deliver reusable media-width aware utility classes, which speeds up the scaffolding process when developing user interfaces.
- NPM
- Ability to compile SCSS
Due to the nature of how this framework works, it will increase the size of your final build dramatically. To circumvent this caveat, it is recommended that you purge any unused classes using purgecss.
Start by installing the package using either NPM or Yarn as specified below.
$ yarn add scssfold
$ npm install scssfold --save
Include the package by importing it in either a JavaScript or SCSS file. We recommend that you import the package in an SCSS file, since that enables you to customize the framework to your needs.
Importing the base module will give you all the modules specified in the Modules section:
@import '~scssfold';
In case you wish to import only a select number of the modules specified in the Modules section, you can target them directly as specified below.
@import '~scssfold/src/modules/spacing/margins';
@import '~scssfold/src/modules/spacing/paddings';
All classes listed in the Modules section below can be prefixed with breakpoints, making them active only once the width of the browser matches the given breakpoint.
If for example, we wanted to use the flex
class, but we'd only want it to be applied on screens that are equal to or greater than the md
breakpoint, we can use it as such:
Take for example the below HTML. We apply the flex
class, determining that the items should flex on the horizontal axis:
<div class="flex">
<p>Item 1</p>
<p>Item 2</p>
<p>Item 3</p>
</div>
But what if we wanted the display: flex
styling only to apply to screens that are equal to or greater than the md
breakpoint? We could write it as such:
<div class="md:flex">
<p>Item 1</p>
<p>Item 2</p>
<p>Item 3</p>
</div>
This applies to all classes delivered by Scssfold.
- Align Content
- Align Items
- Align Self
- Columns
- Direction
- Grow
- Justify Content
- Justify Items
- Justify Self
- Order
- Percentage Width
- Shrink
- Sizing
- Wrap
I initially wrote this framework for myself, but chose to make it public for others to use. I've always been a fan of the BEM methodology. However, over the years, it became more and more clear to me that BEM is not an all-or-nothing approach. Sticking to the BEM methodology strictly resulted in a lot of repetitive CSS, which had both performance and development drawbacks. This framework aims to solve the issue of writing the rough layout of an application; spacings, columns, containers etc. - responsively.
I still use BEM for component styling but try to make components as context-unaware as possible, meaning they have no impact on the layout outside of the component. This makes them more reusable and contributes to a cleaner and more maintainable codebase.