Skip to content
项目

关于

Descartes | Write CSS in JavaScript

网站与应用开发

这些数字如何统计

实测星标增长

24小时
0
7天
0
15天
0
1个月
正在收集历史

各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。

README.md

原文

Descartes

by Jon Chan @jonhmchan

This is an experimental library for writing CSS in JavaScript. The current version is a beta and highly unstable, with changes happening on a daily basis. This library is not recommended for production use. It is actively being developed with your help.

Quickstart

  1. Download descartes.js from the dist folder

  2. Set up Descartes in a webpage by inserting it in your <head> tag, like so:

    <!doctype html>
    <html>
        <head>
            <script type="text/javascript" src="/path/to/descartes.js"></script>
        </head>
        <body>
            <h1>I compute, therefore I am.</h1>
            <script type="text/javascript" src="/path/to/styles.js"></script>
        </body>
    </html>
    
  3. Create a styles.js where you will write your styles. Try the following:

    Descartes.add({
        "body": {
            "color": "#555",
            "font-family": "Arial",
            "h1": {
                "font-family": "Helvetica",
                "font-size": function() {
                    return 16 + Math.round(Math.random() * 42);
                }
            }
        }
    })
    
  4. Save and open up your HTML file in a browser. Clicking anywhere on the window should randomize the size of your heading.

Overview

For a full overview of features, take a look at the presentation I typically give at https://descartes.io/slides (just your right and left arrow keys to go through the slides).

探索相关项目

加载中…