• This repository has been archived on 12/Oct/2020
  • Stars
    star
    224
  • Rank 177,792 (Top 4 %)
  • Language
    OCaml
  • License
    MIT License
  • Created about 7 years ago
  • Updated about 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A CSS-in-JS parser and pipeline adhering to the ISTF spec 🍭

Sweetsour

Sweetsour

A template string CSS parser and pipeline adhering to the ISTF spec 🍭


This is a reference implementation of a CSS (-in-JS) parser, accepting both CSS strings and interpolations, and outputting ISTF, according to the ISTF specification.

Status

Work in Progress: Not ready for any use!

  • Parser
  • Transform tool with plugin support
  • Reference Babel plugin
  • Flattener for nested CSS (plugin)
  • Static prefixer (plugin)

An up-to-date snapshot of the ISTF specification is committed to this repo to avoid confusion while the spec is still being tweaked and expanded.

More information on the progress of the parser can be found here.

Motivation

The project aims to build a common and reusuable pipeline for processing CSS, including interleaved interpolations, for CSS-in-JS libraries; This involves processing CSS-in-JS code, turning it into ISTF, and to provide a pipeline to then transform this code during either the build time (preprocessing), or runtime (postprocessing).

This will enable a couple of things. First of all, ISTF is easy to parse and can be targeted by plugins, which means that language-level features can easily be implemented while not breaking interpolations.

Second, all CSS is parsed, which means that the parser will raise an error, if something's wrong with the code that's been written.

And lastly, ISTF is built to be very efficient and is, unlike ASTs, supposed to be processed during the runtime, which basically means it's supposed to be fast and can be stringified very efficiently back to CSS.

This makes CSS (-in-JS) more accessible for transformations and new features, and should make the runtime a lot faster, since stringification is optimised and all transformations only have to be run once.

More details about the motivation behind the project can be found in the Motivation doc

Goals

The goals of Sweetsour include:

  • Providing a common CSS-in-JS pipeline
  • Enabling stable and fast preprocessing of CSS during buildtime
  • Creating a parser able to parse CSS including interpolations
  • Allowing optional runtime-only support i.e. using Sweetsour in the browser

As opposed to other projects which are fairly similar, like for instance PostCSS, ISTF allows the parser to leave markers for interpolations (typically JS / Babel AST) right inside of the rest of the CSS nodes. The format also breaks CSS down even further than PostCSS, providing tokens for each language feature like at rules, functions, values, attribute selectors, and more. This is achieved by splitting the input up into individual characters and interleaving them with the interpolation input.

The project will provide a few core parts:

  • Parser
  • Transform tool accepting plugins
  • Static Prefixer (plugin)
  • Flattener for nested CSS (plugin)
  • Stringifier turning ISTF back into CSS

More Repositories

1

setup-simple-ipsec-l2tp-vpn

Setup a simple IPSec/L2TP VPN Server for Ubuntu and Debian
Shell
644
star
2

setup-strong-strongswan

[UNMAINTAINED] Setup a (really) strong StrongSwan VPN Server for Ubuntu and Debian
Shell
633
star
3

fluorine

[UNMAINTAINED] Reactive state and side effect management for React using a single stream of actions
JavaScript
286
star
4

docker-strongswan

Docker image for easily setting up a secure StrongSwan VPN
Shell
178
star
5

prosemd-lsp

An experimental proofreading and linting language server for markdown files ✍️
Rust
142
star
6

rxjs-diagrams

React Components for visualising RxJS observables and operators
JavaScript
128
star
7

spectacle-sync

💁 Present Spectacle presentations synchronised on multiple devices
JavaScript
59
star
8

extendable-immutable

Wrapper classes around Immutable.js that turn it inheritable
JavaScript
58
star
9

bunpkg

A proof of concept clone of Unpkg running on Cloudflare Workers
TypeScript
49
star
10

stream-tag

A tagged template literal utility for Node streams
TypeScript
47
star
11

react-compat-component

Marrying ES6 with mixins and more: Compatibility layer for React's ES6 Component class
JavaScript
39
star
12

Adventurous-Syntax

A dark Atom theme using common colors often seen in the cult series Adventure Time.
CSS
28
star
13

react-wonka

Several hooks for using Wonka streams with React
TypeScript
26
star
14

moomin

An experimental JSX/component framework around Reprocessing for Reason
OCaml
17
star
15

graphql-box

[WIP] Instant GraphQL OpenCRUD database that is universally runnable & deployable
TypeScript
17
star
16

pessimism

A fast HAMT Map intended for KV caching and optimistic updates
OCaml
15
star
17

bs-rebel

A toolkit for collections for bsb-native and bsb aimed at bundle size and performance
OCaml
14
star
18

kitten.sh

My collection of posts as found at kitten.sh
JavaScript
12
star
19

redux-fluorine

A Redux enhancer to manage groups of actions as observables ("agendas")
JavaScript
12
star
20

hachiko

WIP: Modular and performant data collections for JavaScript
TypeScript
10
star
21

bs-flow-parser

Flow's JavaScript parser, packaged and adapted for BuckleScript
OCaml
10
star
22

runruntypes

A poor man's runtime-only type checker
JavaScript
9
star
23

system

Nix
9
star
24

vim-adventurous

A dark vim color theme using common colours often seen in the cult series Adventure Time
Vim Script
9
star
25

react-static-plugin-md-pages

react-static plugin to create nested pages from a given source directory
JavaScript
7
star
26

goethe

Node module for immutable color conversion and manipulation
JavaScript
6
star
27

dotfiles

Vim Script
6
star
28

2g

WIP: A cross-platform creative coding framework for Reason
C
6
star
29

didsmoosh

componentDidSmoosh is a comedy night for JS nerds bringing together experts of developer humour on stage
JavaScript
6
star
30

fix-ubuntu-unicorn-for-macbooks

A wizard which can fix multiple issues, bugs and quirks occuring on Macbook Pros running Ubuntu 14.10.
Shell
5
star
31

nightingale

Reason
4
star
32

reason-hmm

HandmadeMath Bindings for OCaml
C++
4
star
33

reason-glsl-optimizer

GLSL Optimizer Bindings for OCaml
C++
4
star
34

threed-example-api

A GraphQL Example API for threaded conversations
JavaScript
4
star
35

advent-of-code-2019

Learning some Rust with "Advent of Code 2019" — because why not?
Rust
4
star
36

bowtie

JavaScript
4
star
37

thought-leader

JavaScript
3
star
38

concurrent-mode-deck

JavaScript
3
star
39

gatsby-theme-docs-system

JavaScript
3
star
40

twitter-was-down-

2
star
41

gatsby-theme-mdx-deck

Modified version of mdx-deck's Gatsby Theme with fixed size slides
JavaScript
2
star
42

vierdreidrei

433Mhz Receiver and Transmitter Module through a RCSwitch wrapper (WIP)
C++
1
star
43

pebble-barely-v2

A simple watchface only using horizontal and vertical straight lines for the Pebble smartwatch. Four squares for the time, four for the date, and four for the year, filling the whole screen. Also invertable!
C
1
star
44

kitten

1
star