GithubHelp home page GithubHelp logo

gustavohernandezp / leaf4demo Goto Github PK

View Code? Open in Web Editor NEW

This project forked from fananek/leaf4demo

0.0 0.0 0.0 694 KB

Vapor - Leaf 4 showcase

CSS 12.83% Swift 71.46% Dockerfile 15.27% Procfile 0.44%

leaf4demo's Introduction

Leaf 4 - demo website

Purpose of this website is to provide examples of Leaf templating engine as a complement to official documentation.

It's powered by Vapor framework and obviously Leaf. Native dark mode support is provided by tailwind.css.

Leaf4Demo screenshot

Prerequisites

Leaf4Demo requires Swift 5.5 or greater. It can be run in docker container as well so you don't have to install swift on your local machine.

How to use it?

git clone https://github.com/fananek/Leaf4Demo
cd Leaf4Demo

# OPTION 1: run directly on your machine
swift run

# OPTION 2: run in a docker container
docker-compose build
docker-compose up app

Open http://localhost:8080

View rendering

If you compare Leaf 4 documentation and our controller, you might notice the controller doesn't call req.view.render("tempalte", context) directly. It uses req.render("template", context) instead.

This is a workaround which provides a global context independent on a specific page context. Idea is pretty simple. Request extension wraps provided context and pass it to real renderer.

Contribution

Any good idea, issue or pull request is welcome. :-)

leaf4demo's People

Contributors

fananek 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.