Giter Club home page Giter Club logo

postcss-rs's Introduction

postcss-rs

🚀 Fast and 100% API compatible postcss replacer, built in Rust

⚠️ DO NOT USE. STILL WORK IN PROGRESS.

Performance Improvement

Run benchmark:

cargo build --release --locked --bin "benchmark*"
cargo run --release --bin benchmark

Tokenizer (Compare with Node.js v16.13.0):

js:   0.71s user 0.09s system 152% cpu 0.619 total
rust: 0.03s user 0.01s system  93% cpu 0.039 total
file tailwind-components.css bootstrap-reboot.css bootstrap-grid.css bootstrap.css tailwind.css tailwind-dark.css
size 2.8K 7.4K 71K 201K 3.5M 5.8M
js 1.813ms 2.380ms 11.856ms 33.919ms 167.309ms 224.577ms
rust 0.019ms 0.037ms 0.191ms 0.721ms 9.624ms 15.743ms
~ 95x 64x 61x 47x 17x 14x

Parser (Compare with Node.js v16.13.0):

js:   1.45s user 0.16s system 183% cpu 0.881 total
rust: 0.10s user 0.03s system  97% cpu 0.137 total
file tailwind-components.css bootstrap-reboot.css bootstrap-grid.css bootstrap.css tailwind.css tailwind-dark.css
size 2.8K 7.4K 71K 201K 3.5M 5.8M
js 4.405ms 4.203ms 33.344ms 55.749ms 356.345ms 441.832ms
rust 0.070ms 0.088ms 1.016ms 2.220ms 45.112ms 68.663ms
~ 63x 47x 33x 25x 8x 6x

🎉 Welcome to contribute, here is a guide:

git checkout main
cargo bench -- --save-baseline main

Create a baseline, Then do some optimization work here.

git checkout feature  ## `feature` is your branch

Compare against the main baseline.

cargo bench -- --baseline main

License

postcss-rs is released under the MIT License. See the LICENSE file in the project root directory for details.

ACKNOWLEDGEMENT

The project is based on the wonderful work of Andrey Sitnik(@ai) 's postcss, which is under MIT License(See HERE), Great thanks to Mr. Sitnik and other contributors' work.

postcss-rs's People

Contributors

cgqaq avatar edsion11 avatar hcysunyang avatar herringtondarkholme avatar iwanabethatguy avatar justjavac avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

postcss-rs's Issues

playground

Though we have a relative stable parser, but still have some corner case that we don't handle, maybe it's better to have a playground help for displaying some issue.

Current status of this project

Hi, I thought about a rust implementation of postCSS for quite some time and I'm glad this attempt exists.
I am a beginner in Rust and while I was able to put together a basic parser using nom, I recon when it comes to visiting and changing the AST I do lack lot of experience with some Rust idiomatic patterns and especially memory management...

I still would like to learn more of the language and I see this project is definitely one I'd like to keep an eye on and eventually contribute to, I do maintain a CSS framework based on postcss-modules and on the long term I'd love to migrate it to rust to make it faster.

I opened this ticket to try and get an overview of the status of the project and how to best contribute.

  1. Is the project currently actively developed? Is there a tentative roadmap or list of known issues/tasks beside the missing plugins?
  2. Would be great to have a contributing guide, a basic description of the architecture and especially a guide to write plugins that may be the most approachable area for external contributors
  3. I am also curious about the plugin API in general, in my mind I envisioned both a Rust API with some Plugin trait with a stable API, as well as maybe a way to use WASM compiled plugins as that may open the door to a larger community and possibly better integration with JS based pipelines (even though most likely lower speed). I wonder if this is something that was discussed and what are your thoughts about it

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.