Giter VIP home page Giter VIP logo

bemit / formantasass Goto Github PK

View Code? Open in Web Editor NEW
2.0 2.0 0.0 1.88 MB

46KB Mini CSS Framework with modular Sass files, compatible and optimized for AMP! Configurable class namings: bootstrap or basscss variant.

Home Page: https://formanta.bemit.codes

License: Other

SCSS 100.00%
amp accelerated-mobile-pages css css-framework css-grid-layout sass sass-framework sass-library scss scss-framework

formantasass's Introduction

Formanta Logo

FormantaSass

npm (scoped)

Feature rich Sass library with small output size: ~46KB (gzip 9.5KB) CSS - or only ~27.5KB (gzip 6.7KB) without responsive spacings!

Low-level OOCSS framework with modular style files (optional CSS output), contains additionally ready to use components to speed up development and page load!

CSS semantics like bootstrap or Basscss (e.g. col-md-6 or md-col-6). Used CSS selectors can be changed for most components, like applying button styles only to .btn and not on .btn, button or using .button/.button-round/.button-lg instead of .btn/.btn-round/.btn-lg.

Take a look & inspect the example page for all selectors and styles. For implementation details check the documentation of Sass and CSS.

Compatible with AMP.

Easily build your homepage with a modern static site generator, try out create-amp-page with one of the starter repos, for AMP or PWA-enhanced pages.

Quick Start

Install package: npm i --save-dev @formanta/sass

Add imports, config and custom styles in your .scss/.sass file:

// `@import` may differ depending on your setup

// overwrite default variables here
$color-primary: pink;

// get mixins, functions, variables from Formanta
@import "node_modules/@formanta/sass/meta";

// a global reset for `p`, as there is no default `p` rule included since formanta `0.22.0`
p {
    margin: 0;
    // or apply `body1` style:
    // @include body1();
}

// own styles which may use Formanta Sass
.bg-grey {
    background: $color-gray-600;
    margin: space(1);
}

// get everything that actually produces CSS from Formanta or import only the wanted styles
@import "node_modules/@formanta/sass/style";

// maybe, maybe overwrite Formanta styles here
// add styles which rely on component variables (e.g. `$panel-shadow`)

Load the transpiled CSS file - faster style your next awesome project!

Small boilerplate to get you started, also on codesandbox, for a more real life example check the example page.

Config

For a full list of variables consult the documentation.

Most important:

Modular Imports

The Sass files are structured, so it's possible to include just the needed styles, but have all variables and mixins ready.

The general overriding order is low-level > specific for variables (_meta*) and specific > low-level for most styles (_style*), this enables the reuse of low-level variables while configuring the more complex structures. But with the inversion at the style order, it is possible to overwrite more specific structures with the low-level CSS styles again.

specific = more complex structures, mostly called components in this library

low-level = low-level / object-oriented CSS rules, called elements / base / attributes in this library

base = lowest low-level CSS rules, based/inspired upon Basscss@v8

This file shows one way to re-build it:

// 1. here the base vars can be overwritten
$spacing: 8px;
$color-light: #f3f3f3;

// 2. import: base, spacing vars and mixins
@import '~@formanta/sass/meta-base';

// here reuse the base vars, e.g.
//    - configure `color-semantic` and attribute/component colors using the `color-map` vars
//    - configure the component sizing, using the spacing vars and mixins

$title-font-color: $color-gray-900;
$font-color: $color-gray-700;
$line-height: 1.45;
$color-primary: #6224ff;
$container-sizes: (
    'small' : $bp-small,
    'medium' : $bp-medium,
    'large' : $bp-large + 100,
    'xlarge' : $bp-xlarge,
);
$button-padding: space(2) space(3);

// 3. import the missing vars and the low-level/basic mixins/variables
@import '~@formanta/sass/meta-attributes';

// here the component vars can be reconfigured, using vars and mixins from the attributes/elements

// 4. import the component defaults/mixins
@import '~@formanta/sass/meta-components';

// 5. get everything that actually produces CSS from Formanta or import only the wanted styles
@import '~@formanta/sass/style-global'; // global html, body style
@import '~@formanta/sass/style-components'; // complex structures (e.g. panel) and basic components
@import '~@formanta/sass/style-elements'; // basic HTML elements (e.g. `h1 - h6`, `body1`, `code`, `blockquote`)

// add own custom structures here, so they can be overwritten using the low-level styles,
// but can override basic styles of titles, links, buttons etc.

// 6. get the low-level CSS output rules
@import '~@formanta/sass/style-attributes'; // low-level attribute rules, incl. typography attribute styles, responsive spacings
@import '~@formanta/sass/style-base'; // low-level base rules

// here - if really necessary - the low-level rules can be overwritten

Aims

Having a code-controlled CSS framework, which produces CSS from variable configurations and provides logic components, to ease config-based styles in clean-data environments.

additional aim since 0.20.0:

Combining the flexibility of low-level style architectures, like Basscss, with the readyness and consistency of frameworks like Bootstrap.

Using the CSS generator (Sass) var overriding together with optional CSS output and CSS overriding patterns to produce a small-size output.

From Version >0.20.0 onwards this library is inspired and based upon mustard-ui and Basscss. But written in Sass, with more configuration options through Sass variables, which where not existing in mustard or done by CSS vars in Basscss. Sass mixins are included for easier reuse without copying Sass/CSS.

additional aim since 0.23.0:

Optimal design translations from UI language specifications, through better interoperable low-level attributes and elements which use e.g. Material-UI influenced color semantics, together with the low-level/OOCSS type of naming, modular components and controlled CSS output.

Versions

This project is in beta.

This package is managed in a monorepo.

Pre Build CSS

Prebuild CSS are available to try it out with some default configs.

build together with normalize.css v8.0.1, except the two files with the -no-normalize suffix

License

Formanta: Michael Becker / bemit MIT License

Since 0.20.0 influenced and based upon:

Basscss: Copyright (c) 2013 โ€“ 2016 Brent Jackson, MIT License, used as initial source of base/low-level rules.

Mustard-UI: Copyright 2018 Kyle Logue, MIT License, used as initial code for forms, buttons and other elements, the general influence of components.

Copyright

2015 - 2022 | Michael Becker, bemit

formantasass's People

Contributors

elbakerino avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

formantasass's Issues

Finalize variables

// issue stub

Finalizing correct usage of variables everywhere, with as much support for CSS Variables as possible.

Add bootstrap naming support to spacings

// issue stub

  • currently .mla (Basscss) can be used for margin-left: auto, but bootstrap offers classes like ml-auto
  • additionally there should be some "light-version" example with only responsive spacing for xs and md
  • additionally responsive autos doesn't exist currently (e.g. mta-md) and should be added

Add `mxa` responsive

Currently mxa/mya/mra/mla/mta/mba are not included in responsive spacings, but should be.

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.