GithubHelp home page GithubHelp logo

s-acss / sacss Goto Github PK

View Code? Open in Web Editor NEW
15.0 1.0 0.0 1.09 MB

Create Utility First CSS library for your project faster and easier.

Home Page: https://s-acss.github.io/

License: MIT License

JavaScript 7.53% CSS 10.84% Less 29.90% SCSS 27.91% Stylus 23.83%
acss tailwind-css utility-css sacss atomic-css figma-plugin

sacss's Introduction

SACSS

SACSS: Static Atomic CSS

SACSS is attempt to help you create Utility First CSS class library for your project more fast and easy.

npm package jsdelivr github

English | 简体中文

Why Utility First CSS?

Naming is one of the most difficult problems in CSS

Content-based semantic naming enables you to create artwork.

However, in a multi-person collaborative project, naming that you think is semantic can often be a nightmare to be around.

While BEM can standardize the way everyone on the team names things, however everyone still needs to name things based on their own understanding.

Among the popular CSS solutions, Utility First CSS solves this problem relatively effectively.

Because it already has a series of CSS class names for the UI that needs to be built, the core pain point of naming is naturally solved since there is no naming.

Utility First CSS

<style>
/* The following CSS code has already been created in the initial phase, and only needs to be used in the development phase */
.fs16{ font-size: 16px; }
.lh24{ line-height: 24px; }
.fw400{ font-weight: 400; }
.fw900{ font-weight: 900; }
</style>

<h1 class="fs16 lh24 fw900">Hello world</h1>
<p class="fs16 lh24 fw400">Utility First CSS</p>

Semantic CSS

<style>
.h1{
  font-size:16px;
  line-height:24px;
  font-weight:900;
}
.paragraph{
  font-size:16px;
  line-height:24px;
  font-weight:400;
}
</style>
<h1 class="h1">Hello world</h1>
<p class="paragraph">Semantic CSS</p>

Ideally, we don't need to create any CSS Classes, we just need to combine (piece together multiple Classes) to complete the UI.

Of course, Utility First CSS solves the core pain point of naming.

It also significantly improves CSS writing efficiency and minimizes CSS code bulk.

The more functional a Class is, the higher the reuse rate

Why Not Tailwind CSS?

Tailwind CSS is very good, but not always suitable.

There are many CSS solutions based on Utility First CSS, the most famous one is Tailwind CSS which is also the ! github has the highest number of libraries.

Tailwind CSS class library provides rich and comprehensive CSS class names, so that we can quickly implement UI by focusing on HTML.

However, because it is big and comprehensive, it is relatively expensive to get started and remember, and there is always a feeling of killing a chicken with a bull.

SACSS is focused on showing you how to create Utility First CSS ([naming convention](. /guides.name)).

For example, if you want to achieve the text horizontally centered text-align:center; effect.

When using Tailwind CSS, we need to search through the entire library of hundreds of Class Name classes to find the Class Name (.text-center) that corresponds to horizontally centered.

When using SACSS, your path is this: you first know that the code for horizontally centered is .text-align:center; and then you get .tac based on the formula for naming rules that only take initial letters.

That means you see the Style property and you know what the corresponding Class Name is, no need to remember it at all, and this pattern will greatly increase the development experience.

<!-- Tailwind CSS -->
<style>
.text-center{ text-align: center; }
</style>
<h1 class="text-center">hello world</h1>

<!-- SACSS -->
<style>
.tac{ text-align: center; }
</style>
<h1 class="tac">hello world</h1>

We also created the [Figma plugin] for this set of naming rules (. /intro.design), with this plugin you even you only need to copy and paste the project code from the design tool.

It is better to give a man a fish than to teach him how to fish.

Different

Declarations SACSS ACSS Tailwind CSS Basscss Tachyons
margin: 12px; .m12 .M(12px) .m-4 .m2 .ma3
text-align: center .tac .Ta(c) .text-center .center .tc
margin: -12px .m-12 .M(-12px) .-m-4 .mxn2 .na3
font-size: 25px .fs25 .Fz(25px) .text-2xl .h2 .f3
width: 50% .w50% .W(50%) .w-1/2 .col-6 .w-50
line-height: 1.5 .lh1.5 .Lh(1.5) .leading-normal .line-height-4 .lh-copy
- - More More More More

It is clear that the naming of SACSS is more standard and simple than other types of projects.

Inspiration

  • Tailwind CSS: the most popular Utility First CSS class library.
  • Atomic CSS: The core idea (Yahoo!).
  • Fower: An utility-first CSS in JS library for rapid UI development (Documentation Inspiration);
  • Emmet: Naming rules inspired by Emmet, many IDEs have this rule built in;

sacss's People

Contributors

ziven27 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

sacss's Issues

补充命名的困扰

还有,这个解决方案解决了命名的困扰,这个我相信是很多人的痛点,可以多提一些,我碰到过的就有比如说是wapper包container还是container包wrapper,header还是hd,有的时候title不在header里面也觉得不合适

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.