Skip to content

Instantly share code, notes, and snippets.

@iegik
Last active November 5, 2023 13:41
Show Gist options
  • Save iegik/5d07c579b84bf4a5e2331c144fb1b602 to your computer and use it in GitHub Desktop.
Save iegik/5d07c579b84bf4a5e2331c144fb1b602 to your computer and use it in GitHub Desktop.

CSS

Frameworks

Pre-processing

graph TD;
    App-->Mobile;
    App-->Hybrid;
    App-->Web;
    Mobile-->Styled;
    Hybrid-->Complex;
    Complex-->Styled;
    Web-->Complex;
    Web-->Simple;
    Simple-->CSSmodules;
    Complex-->CSSmodules;
Loading

Post processing

CSS plugins

Postcss plugins

See also:

Design patterns

  • BEM
  • reset.css
  • 12 / 16 grid system
  • float & clearfix / flexbox / grid

Accessability

:root {
--var1: 0;
}
.root {
/* .root-ZxY */
}
.module .btn {
/* .module-xYz .btn-Yzx */
}
.module :global .btn {
/* .module-xYz .btn */
}
/**
// in module.js
import styles from 'CSS.module.css'
const foo = () => `
<div class="${styles.root}">
<button class="${styles.btn} btn">Button</button>
</div>
`
*/
/* Variables */
@sizes: xs,s,m,l,xl;
@font-sizes: 10px, 12px, 14px, 22px, 32px;
@grid-columns: 1,2,3,4,5,6,7;
@grid-module-width: 30px;
@grid-module-gap: .5em;
/* Mixins */
.no-wrap() {
white-space: nowrap;
}
.ellipsis() {
text-overflow: ellipsis;
overflow: hidden;
}
/*
* Grid system with CSS3 grids
* https://codepen.io/iegik/pen/LexNNQ?editors=1100
*/
@import 'utils';
@import 'variables';
.grid(@min: @grid-module-width; @max: 1fr; @gap: @grid-module-gap){
display: grid;
grid-template-columns: repeat(auto-fit, minmax(@min, @max));
grid-gap: @gap;
}
.col(@cols) {
grid-column: span @cols;
}
.row(@rows) {
grid-row: span @rows;
}
.each(@grid-columns, {
.col-@{value} {
.col(@index);
}
});
/* Functions (utils) */
.each(@list, @fn, @index: 1) when (@index =< length(@list)) {
@key: @index + 1;
@value: extract(@list, @index);
@fn();
.each(@list, @fn, @key);
}
/* Exampe */
@import 'utils';
@import 'variables';
.each(@sizes, {
.ft-@{value} {
font-size: extract(@font-sizes, @index);
}
});
/* variables */
/* functions */
/* exampe */
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment