stylex README

The project's README from github.com/facebook/stylex. As one markdown file: README.md.

StyleX · GitHub license npm version tests PRs Welcome

StyleX is a JavaScript library for defining styles for optimized user interfaces.

Documentation

Documentation Website

Documentation for individual packages can be found in their respective README files. Start with @stylexjs/stylex.

Example

Here is a simple example of StyleX use:

import * as stylex from '@stylexjs/stylex';

const styles = stylex.create({
  root: {
    padding: 10,
  },
  element: {
    backgroundColor: 'red',
  },
});

const styleProps = stylex.props(styles.root, styles.element);

Development

This is the development monorepo for StyleX.

Structure

Tasks

First, yarn install the yarn workspace.

Contributing

Development happens in the open on GitHub and we are grateful for contributions including bug fixes, improvements, and ideas.

Code of Conduct

This project expects all participants to adhere to Meta's OSS Code of Conduct. Please read the full text so that you can understand what actions will and will not be tolerated.

Contributing Guide

Read the contributing guide to learn about our development process, how to propose bug fixes and improvements, and how to build and test your changes.

Architectural Principles

Before proposing a change or addition to the StyleX API, you should familiarize yourself with the goals and architectural principles of the project.

License

StyleX is MIT licensed.

stylex (facebook/stylex)

Searching Database…

10.4K ·GitHub
这是什么?StyleX 是 Meta 推出的样式系统——一个用来为优化过的用户界面定义样式的 JavaScript 库。
所以我是在 JavaScript 里写样式,而不是写在 CSS 文件里?是的——样式直接在 JavaScript 代码中定义,而不是放在独立的 CSS 文件里;这种“用 JS 写样式”的模式正是 StyleX 的核心。
怎么把它加到我的项目里?从 npm 安装 @stylexjs/stylex 包——README 里把它列为入门起点——然后照着文档网站继续操作即可。
它能用普通的 script 标签引入,还是必须有构建步骤?必须有构建步骤:你的样式会在构建流程中由 StyleX 的 Babel 插件编译。
构建集成是不是得我自己摸索?不用——仓库自带一个 examples 文件夹,里面已经把 StyleX 接入了各种构建工具,你可以从一个能跑通的配置开始。
它也能用于原生移动应用吗,还是只支持网页?它面向的是 Web 用户界面:StyleX 是一个基于 CSS 的样式系统,接入的是标准的 Web 构建链路。
除了核心库,这个仓库里还有些什么?这是一个基于 yarn workspace 的 monorepo:除了 stylex 包,还有 PostCSS 和 Rollup 插件、ESLint 插件、一个 CLI、一个样式值解析器、文档以及性能基准测试。
Creator
facebook
Size
18.5 MB
Stars
10.4K
Age
3y
Commits · 90 Days