Một mục mã nguồn mở trong kho dữ liệu GitHub của TopGit: krasimir/cssx, 1.0k sao, JavaScript. CSS in JavaScript
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.
Generate and/or apply CSS with JavaScript. Try it out here.
Demos
Transpilation process - you write JavaScript that contains CSSX and see AST, transpiled JavaScript and the produced CSS
JS + HTML + output - you write JavaScript that contains CSSX + HTML markup and see the result when the CSS is applied to the DOM
JS + output - same as a above but without changing the markup
Language:
CSSX language
Editor Integration
Vote for JetBrains integration
Integration with other tools:
JSS or alternatively CSSX client-side library (download or npm i cssx)
CSSX-transpiler (download or npm i cssx-transpiler)
CSSX-CLI (npm i cssx-cli -g)
Gulp plugin (npm i gulp-cssx -D)
Webpack loader (npm i cssx-loader -D)
Meteor package (meteor add quadric:cssx)
Browserify transform (npm i browserify-cssx -D)
CSSX component for React
jspm integration
ESLint plugin
Rollup plugin
Plugins:
CSSX plugins - See how to create CSSX plugins or use PostCSS plugin collection together with CSSX.
Examples:
Try it out
Try it out (developer edition)
Basic
Transpiling
Transpiling with gulp
Transpiling with webpack
In React component
Using with jss
(at build time) CSSX together with PostCSS and Autoprefixer
(at runtime in a browser) CSSX together with PostCSS and a plugin
Bundling with jspm
Premise
CSSX is not only about writing vanilla CSS in JavaScript. Even though you get this the main idea here is to have a good API for managing styles. CSSX doesn't inline styles so you keep your markup clean. It works directly with injected stylesheets. Here is a short example:
function setStyles (fontSize, margin) {
return <style>
body {
font-size: {{ fontSize }}px;
line-height: {{ fontSize * 1.2 }}px;
margin: {{ margin }}px;
}
</style>
}
var sheet = cssx();
sheet.add(setStyles(20, 6));
sheet.add(<style>
p > a {
text-decoration: none;
color: #F00;
}
</style>);
The code above is transpiled into valid JavaScript that uses the CSSX client-side library:
body {
margin: 6px;
line-height: 24px;
font-size: 20px;
}
p > a {
color: #F00;
text-decoration: none;
}
How to use CSSX
CSSX could be considered a pattern where we dynamically create CSS stylesheets and control their content with JavaScript. The bare minimum is including CSSX client-side library on the page. Doing that you'll have an access to the top level API. The same library is published to npm so npm install cssx -S.
If you want to use the CSS-ish syntax in JavaScript then you'll need the transpiler. It's a available as a standalone file, but it's not recommended using it in the browser. What you should do is integrating the transpiler in your build process.
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/krasimir/cssx là nguồn chính thức.
krasimir/cssx có bao nhiêu sao?
krasimir/cssx có 1.0k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/krasimir/cssx. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
krasimir/cssx có phải mã nguồn mở không?
Có — krasimir/cssx 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/krasimir/cssx.
krasimir/cssx còn đang phát triển không?
Commit gần nhất trên krasimir/cssx là 9.7 năm trước (theo timestamp GitHub). Repo có 36 fork — một chỉ báo về mức độ quan tâm của cộng đồng.
krasimir/cssx là gì?
krasimir/cssx (krasimir/cssx) là dự án JavaScript trên GitHub. Theo mô tả gốc: CSS in JavaScript
Đọc đầy đủ README ở tab phía trên.
cssx có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về cssx.