Một mục mã nguồn mở trong kho dữ liệu GitHub của TopGit: postcss/sugarss, 719 sao, JavaScript. Indent-based CSS syntax for PostCSS
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
VÌ SAO CHƯA CÓ REVIEW
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
a
color: blue
.multiline,
.selector
box-shadow: 1px 0 9px rgba(0, 0, 0, .4),
1px 0 3px rgba(0, 0, 0, .6)
// Mobile
@media (max-width: 400px)
.body
padding: 0 10px
As any PostCSS custom syntax, SugarSS has source map, stylelint
and postcss-sorting support out-of-box.
It was designed to be used with postcss-simple-vars and postcss-nested.
But you can use it with any PostCSS plugins
or use it without any PostCSS plugins.
With postcss-mixins you can use @mixin syntax as in Sass.
SugarSS is built by Evil Martians, an American design and engineering consultancy for developer tools, AI, and cybersecurity startups.
Syntax
SugarSS MIME-type is text/x-sugarss with .sss file extension.
Indent
We recommend 2 spaces indent. However, SugarSS autodetects indent
and can be used with tabs or spaces.
But it is prohibited to mix spaces and tabs in SugarSS sources.
Multiline
SugarSS was designed to have intuitively multiline selectors and declaration
values.
There are 3 rules for any types of nodes:
// 1. New line inside brackets will be ignored
@supports ( (display: flex) and
(display: grid) )
// 2. Comma at the end of the line
@media (max-width: 400px),
(max-height: 800px)
// 3. Backslash before new line
@media screen and \
(min-width: 600px)
In a selector you can put a new line anywhere. Just keep same indent
for every line of selector:
.parent >
.child
color: black
In a declaration value you can put a new line anywhere. Just keep a bigger indent
for the value:
There is no “silent” comment in SugarSS. Output CSS will contain all comments
from .sss source. But you can use postcss-discard-comments
for Sass’s silent/loud comments behaviour.
Rule and Declarations
SugarSS separates selectors and declarations by :\s or :\n token.
So you must write a space after the property name: color: black is good,
color:black is prohibited.
Other
SugarSS is just a syntax, it change the way how you write CSS,
but do not add preprocessor features build-in.
Here are PostCSS plugins which could add you preprocessor features:
postcss-simple-vars adds variables.
postcss-nested adds nested rules.
postcss-import adds @import directive support.
postcss-import-ext-glob extends postcss-import path resolver to allow glob usage as a path.
postcss-mixins add @mixin support.
postcss-functions allows you to define own CSS functions in JS.
Text Editors
SublimeText: Syntax Highlighting for .SSS SugarSS
Atom: language-postcss, source-preview-postcss and build-sugarss
Vim: vim-sugarss
VSCode: vetur, and postcss-sugarss-language
We are working on syntax highlight support in text editors.
Right now, you can set Sass or Stylus syntax highlight for .sss files.
Usage
SugarSS needs PostCSS compiler. Install postcss-loader for webpack,
gulp-postcss for Gulp, postcss-cli for npm scripts.
Parcel has build-in support for PostCSS.
Then install SugarSS: npm install --save-dev postcss sugarss if you use npm
and yarn add --dev postcss sugarss if you use Yarn.
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/postcss/sugarss là nguồn chính thức.
postcss/sugarss có bao nhiêu sao?
postcss/sugarss có 719 sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/postcss/sugarss. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
postcss/sugarss có phải mã nguồn mở không?
Có — postcss/sugarss phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/postcss/sugarss.
postcss/sugarss còn đang phát triển không?
Commit gần nhất trên postcss/sugarss là 19 ngày trước (theo timestamp GitHub). Repo có 37 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
postcss/sugarss là gì?
postcss/sugarss (postcss/sugarss) là dự án JavaScript trên GitHub. Theo mô tả gốc: Indent-based CSS syntax for PostCSS
Đọc đầy đủ README ở tab phía trên.
Vẫn đang phân vân về sugarss?
Một cú bấm sẽ gửi câu hỏi kèm trang này cho AI — xem AI nói gì về sugarss.