Git Product home page Git Product logo

rust-petite-vue's Introduction

Rust and Petite-Vue

Inspired by Jack Herrington's experiment

Ingredients:

  • Rust & Rocket server
  • petite-vue (~8kB)

Result:

  • 100/100 Lighthouse score (even with using v-effect, see below)

Running

Grab the data server from Jack's repo and run the server:

% cd data
% binserve

This will serve the pokemon data on port 8080. You can use binserve or any other fast static server.

Then run the following in this repo (assuming you have Rust and Cargo):

Rust (Rocket)

cd rust
cargo run -r

Serves on: http://locahost:8000/

Caveats

You can actuall do a lot with petite-vue, however replacing the initially rendered html fragment (see /templates/partial.html.tera) with a fetched one will result an initial flash because vue will replace the whole data table. However you can add a small mod to /templates/index.html.tera:

Instead of this:

<main class="p-5" id="root" v-scope>

Use this:

<main class="p-5" id="root" v-scope v-effect={fetchData()}>

The drawback here is of course an initial fetch and content replace after the server render - the flash I mentioned will not appear though.

As you can see in the templates you can do a lot by mixing tera and vue style props like v-model etc.

rust-petite-vue's People

Contributors

yaanno avatar

Watchers

 avatar

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.