Skip to content

Commit

Permalink
Merge branch 'r/0.3.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
emirror-de committed Mar 4, 2022
2 parents b0b1146 + 8797afb commit 77d63d6
Show file tree
Hide file tree
Showing 315 changed files with 30,949 additions and 781 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ name: Rust

on:
push:
branches: [ main ]
branches: [ main, develop ]
pull_request:
branches: [ main ]
branches: [ main, develop ]

env:
CARGO_TERM_COLOR: always
Expand All @@ -17,6 +17,6 @@ jobs:
steps:
- uses: actions/checkout@v2
- name: Build
run: cargo build --all-features --verbose
run: cargo build -p lewp --all-features --verbose
- name: Run tests
run: cargo test --all-features --verbose
run: cargo test -p lewp --all-features --verbose
8 changes: 0 additions & 8 deletions .tmuxp.yml

This file was deleted.

38 changes: 38 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# Contributing

Thanks for choosing to contribute to `lewp-rs`! You can find a few details about the contributing standards that `lewp-rs` follows.

*A pull request template is currently in progress, until released please add as much as information to the PR as you can about the changes you made*

## Testing

Please make sure that every commit is a complete one, meaning the code should run as expected. This includes that all tests in `cargo test --all-features` pass.

## GIT usage

This project follows [git flow](http://danielkummer.github.io/git-flow-cheatsheet/). The main development takes place in the `develop` branch. Please make sure that your PR goes in there. The `main` branch is the production release branch. The following prefixes are used:

* `f/` for feature branches
* `b/` for bugfix branches
* `r/` for release branches
* `h/` for hotfix branches
* `s/` for support branches
* `v` is the version tag prefix

## Commit messages

The commit messages **must** follow [conventional commits](https://www.conventionalcommits.org/en/v1.0.0).

Available scopes are:

* `css` - for the `lewp-css` crate

* `selectors` - for `lewp-selectors` crate

* `html` - for `lewp-html` crate

* `lewp` - for the main crate

## Code conventions

This project follows the standard [Rust naming conventions](https://rust-lang.github.io/api-guidelines/naming.html). Make sure that your code is formatted by `rustfmt` before committing.
4 changes: 2 additions & 2 deletions COPYRIGHT.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## Short version for non-lawyers:

Copyright (c) `2021` `Lewin Probst, M.Sc.`
Copyright (c) `2022` `Lewin Probst, M.Sc.`

This project is licensed under the terms of either Apache 2.0 or MIT license at
your option.
Expand All @@ -13,7 +13,7 @@ SPDX-License-Identifier: MIT OR Apache-2.0

## Longer version:

Copyright (c) `2021` `Lewin Probst, M.Sc.`
Copyright (c) `2022` `Lewin Probst, M.Sc.`

Copyrights in this project are retained by contributors. No copyright assignment
is required to contribute to this project.
Expand Down
35 changes: 7 additions & 28 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,28 +1,7 @@
[package]
name = "lewp"
version = "0.2.0"
authors = ["Lewin Probst <[email protected]>"]
edition = "2018"
license = "MIT OR Apache-2.0"
description = "Say goodbye to the web template hell. Generate your HTML5 website technically optimized and always valid. In your Rust source."
homepage = "https://github.com/emirror-de/lewp-rs"
documentation = "https://docs.rs/lewp"
repository = "https://github.com/emirror-de/lewp-rs"
readme = "README.md"
keywords = ["HTML5", "CSS", "JavaScript", "WASM", "modules"]
categories = ["web-programming"]

[features]
full = ["submodules"]
submodules = []

[dependencies]
serde = { version = "^1.0.130", features = ["derive"], optional = true }
log = "^0.4.14"
langtag = "^0.2.0"
html5ever = "^0.25.1"
markup5ever_rcdom = "^0.1.0"
charsets = "^0.2.0"

[dev-dependencies]
rand = "0.8.4"
[workspace]
members = [
"lewp-selectors",
"lewp-css",
"lewp-html",
"lewp"
]
2 changes: 1 addition & 1 deletion LICENSE-APACHE
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
same "printed page" as the copyright notice for easier
identification within third-party archives.

Copyright [2021] [Lewin Probst, M.Sc.]
Copyright [2022] [Lewin Probst, M.Sc.]

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
Expand Down
2 changes: 1 addition & 1 deletion LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2021 Lewin Probst, M.Sc. <[email protected]>
Copyright (c) 2022 Lewin Probst, M.Sc. <[email protected]>

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
91 changes: 62 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,63 +1,96 @@
![https://gitlab.com/lewp/lewp/-/raw/master/logo/lewp-transparent-background.inkscape.svg](https://gitlab.com/lewp/lewp/-/raw/master/logo/lewp-transparent-background.inkscape.svg)
![](logo/lewp-transparent-background.inkscape.png)

----------------

![Version](https://img.shields.io/crates/v/lewp?style=flat-square)[![](https://img.shields.io/docsrs/lewp?style=flat-square)](https://docs.rs/lewp)![Downloads](https://img.shields.io/crates/d/lewp?style=flat-square)![MIT or Apache-2.0 License](https://img.shields.io/crates/l/lewp?style=flat-square)[![](https://img.shields.io/discord/855726181142495242?color=154683&label=discord&style=flat-square)](https://discord.gg/nx7YtsjEbT)
![Version](https://img.shields.io/crates/v/lewp?style=flat-square) [![](https://img.shields.io/docsrs/lewp?style=flat-square)](https://docs.rs/lewp) ![Downloads](https://img.shields.io/crates/d/lewp?style=flat-square) ![MIT or Apache-2.0 License](https://img.shields.io/crates/l/lewp?style=flat-square) [![](https://img.shields.io/discord/855726181142495242?color=154683&label=discord&style=flat-square)](https://discord.gg/nx7YtsjEbT)

Say goodbye to the web template hell. Generate your HTML5 website technically optimized and always valid. In your Rust source.
Say goodbye to the web template hell. Generate your HTML5 website technically optimized and always valid. Without leaving Rust source.

*This is the adjusted Rust implementation of [the PHP version of lewp](https://gitlab.com/lewp/lewp).*

If you have questions, want to contribute or have any other type of request, your invited to create an issue or visit the [openprobst.dev](https://openprobst.dev) discord server.

## Features
## ❓What is lewp?

Many frameworks already exist that support developers in creating websites and -apps in various languages, eg. [Laravel](https://laravel.com/), [Symfony](https://symfony.com/), or [Django](https://www.djangoproject.com/) just to name a few. They usually follow the [MVC pattern](https://www.tutorialspoint.com/design_pattern/mvc_pattern.htm). You can create a controller for every route and add a model as well as a view for this, all in separate folders. So far, nothing new, a well known and proven concept. However, several problems can arise regarding e.g. code quality, re-usability as well as best practices of SEO and much more. The architecture of these frameworks can lead developers to become inconsistent considering their code structure. Because the files are spread over the whole project, the reusability of code can easily suffer. In addition to that, the usage of templating systems like [Twig](https://twig.symfony.com/) can make the developer create invalid HTML code without recognizing it or create problems relating to for example page loading times [(which is a crucial factor)](https://www.marketingdive.com/news/google-53-of-mobile-users-abandon-sites-that-take-over-3-seconds-to-load/426070/), the [critical rendering path](https://varvy.com/pagespeed/critical-render-path.html) or avoiding ["extra whitespace between HTML tags to avoid browser rendering quirks under some circumstances"](https://twig.symfony.com/doc/3.x/filters/spaceless.html). In the latter (a cite from the [Twig](https://twig.symfony.com/doc/2.x/filters/spaceless.html) documentation), Twig has a property to prevent this, but you need to explicitly enable it and "*its performance is directly related to the text size you are working on*". Developing in these environments can run the risk of spreading those problems over your whole project, making it almost impossible to recover from without rewriting your code base.

So the idea was to create a framework that tries to minimize the impact of the stated problems without making compromises on the comfort of programming.

Therefore, lewp focuses on

- making it **easy** for the developer in **creating valid** HTML code,
- make the developer **instantly know where** the **files are stored**,
- ***true* modularity** and therefore **re-usability** of source code,
- **minimize** the [**cumulative layout shift**](https://web.dev/cls/) on loading
- applying **SEO** best practices already in development setup as much as possible,
- **minimization** **page loading times**, especially [FCP](https://web.dev/first-contentful-paint/) and [TTI](https://web.dev/interactive/),
- **flexibility** for the developer (you are able to add other dependencies to your modules without effort),
- **reducing** the **external dependencies** that are sent to the client and therefore
- **minimize** the **chaos in** your projects **source code**

lewp generates a highly optimized HTML web page and provides automatic handling of your CSS code (and your JavaScript soon) if you want to. Have a look at the examples folder for more information about how to use it.

***lewp is not a webserver.*** It is a framework that supports you in structuring your algorithms bringing them perfectly in line with your view, without letting your code get messy! It perfectly integrates with frameworks like [rocket](https://rocket.rs) or [actix-web](https://actix.rs).



## 📦 Features

- [x] Build your HTML website fully from Rust source
- [x] No additional fancy markup or language, just a clean API
- [x] Never touch confusing templates again
- [x] Always emit correct, minimized HTML5
- [x] Develop your Website as fully self-contained modules, never interfering each other
- [x] Always serve correct, minimized HTML5
- [x] Develop your Website as fully isolated modules

## Roadmap
## 🚌 Roadmap

- [x] Skeleton to create website with by creating the DOM
- [x] A webpage can have Modules
- [x] Each module is surrounded by a wrapper `div`
- [x] Each module is surrounded by a wrapper `div`
- [x] A page is created with isolated modules (HTML only)
- [x] Modules can have Modules, infinite loops are prevented
- [x] Submodules have `RuntimeInformation` available
- [x] Submodules have `RuntimeInformation` available
- [x] `<head>` modules only
- [x] The wrapping `div` tag can be disabled *(recommended only for `<head>` modules)*
- [ ] Add possibility to add attributes to the container wrapping the module
- [ ] Added CSS integration
- [ ] File structure is defined
- [ ] Combining files is implemented
- [ ] Minimization of CSS is implemented
- [ ] Directories can be configured on module level
- [ ] Modules are isolated (HTML, CSS)
- [ ] Added [html5-picture](https://github.com/emirror-de/html5-picture) support
- [ ] Conversion of pictures on startup is possible
- [ ] API for a global register that holds all pictures and creates the HTML code
- [ ] Added JavaScript integration
- [ ] File structure is defined
- [ ] Combining files is implemented
- [ ] Minimization is implemented
- [ ] JavaScript is isolated
- [ ] Directories can be configured on module level
- [x] File hierarchy for CSS and JS is defined
- [ ] Prevent `/` in IDs
- [ ] Remove `..` in IDs
- [ ] CSS integration
- [x] Combining files is implemented
- [x] Minimization of CSS is implemented
- [x] Modules without CSS are skipped
- [x] CSS links are automatically inserted into the HTML `<head>` tag if files are available
- [ ]
- [ ] CSS can be split up into "render critical" (will be inlined on rendering) and "non render critical" parts
- [x] A CSS register is implemented that can be used as shared global querying instance for CSS files
- [x] Modules are isolated (HTML, CSS)
- [ ] Page specific CSS is possible
- [ ] JavaScript integration
- [ ] Combining files is implemented
- [ ] Minimization is implemented
- [ ] HTML can be streamed
- [ ] Modules are now fully isolated (HTML, CSS, JavaScript)
- [ ] JavaScript and CSS can be compiled into the binary
- [ ] Add attributes to the container wrapping the module
- [ ] Configuration using `.toml` files
- [ ] Modules
- [ ] Pages
- [ ] Added [html5-picture](https://github.com/emirror-de/html5-picture) support
- [ ] Conversion of pictures on startup is possible
- [ ] API for a global register that holds all pictures and creates the HTML code
- [ ] Provide an API for localization (l10n)
- [ ] Provide an API for generic resources
- [ ] Modules can have isolated folders for temporary files
- [ ] CSS can be split up into "render critical" (will be inlined on rendering) and "non render critical" parts
- [ ] CSS attributes can be configured
- [ ] CSS attributes can be configured
- [ ] Modules can send events to sub-modules

## Contributing
## 🤠 Contributing

Unless explicitly stated, any contribution intentionally submitted for inclusion in this project, as defined in the Apache-2.0 license, shall be dual licensed as below, without any additional terms or conditions.

## License
Please have a look at [CONTRIBUTING.md] for guidelines and conventions.

## ⚖ License

Licensed under either of

Expand Down
2 changes: 2 additions & 0 deletions lewp-css/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/target
Cargo.lock
Loading

0 comments on commit 77d63d6

Please sign in to comment.