MCPcopy Index your code
hub / github.com/emirror-de/lewp-rs

github.com/emirror-de/lewp-rs @v0.3.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.3.0 ↗ · + Follow
1,496 symbols 2,894 edges 269 files 277 documented · 19%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README


Version Downloads MIT or Apache-2.0 License

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.

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 discord server.

❓What is lewp?

Many frameworks already exist that support developers in creating websites and -apps in various languages, eg. Laravel, Symfony, or Django just to name a few. They usually follow the MVC pattern. 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 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), the critical rendering path or avoiding "extra whitespace between HTML tags to avoid browser rendering quirks under some circumstances". In the latter (a cite from the Twig 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 on loading
  • applying SEO best practices already in development setup as much as possible,
  • minimization page loading times, especially FCP and TTI,
  • 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 or actix-web.

📦 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 serve correct, minimized HTML5
  • [x] Develop your Website as fully isolated modules

🚌 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] A page is created with isolated modules (HTML only)
  • [x] Modules can have Modules, infinite loops are prevented
  • [x] Submodules have RuntimeInformation available
  • [x] <head> modules only
  • [x] The wrapping div tag can be disabled (recommended only for <head> modules)
  • [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 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 attributes can be configured
  • [ ] Modules can send events to sub-modules

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

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

⚖ License

Licensed under either of

  • Apache License, Version 2.0 (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
  • MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)

at your option.

Extension points exported contracts — how you extend this code

Page (Interface)
Main trait of a page. [8 implementers]
lewp/src/page.rs
Separated (Interface)
Marker trait on T to automatically implement ToCss for Vec when values of T are separated by some delimiter `delim`. [5 …
lewp-css/src/parsers/separators/separated.rs
Push (Interface)
A trait to abstract over a `push` method that may be implemented for different kind of types. Used to abstract over `Ar [3 …
lewp-selectors/sink.rs
NonTSPseudoClass (Interface)
A trait that represents a pseudo-class. [2 implementers]
lewp-selectors/parser.rs
SelectorVisitor (Interface)
A trait to visit selector properties. All the `visit_foo` methods return a boolean indicating whether the traversal sho [1 …
lewp-selectors/visitor.rs
NodeExt (Interface)
Methods for easy interaction with a `DOM` [Node]. [1 implementers]
lewp-html/src/node_ext.rs
BloomStorage (Interface)
(no doc) [2 implementers]
lewp-selectors/bloom.rs
Element (Interface)
(no doc)
lewp-selectors/tree.rs

Core symbols most depended-on inside this repo

write_str
called by 150
lewp-css/src/blocking_io_only_std_fmt_write_to_std_io_write_adaptor.rs
write_char
called by 118
lewp-css/src/blocking_io_only_std_fmt_write_to_std_io_write_adaptor.rs
clone
called by 90
lewp-selectors/bloom.rs
next
called by 74
lewp-selectors/bloom.rs
parse
called by 69
lewp-selectors/parser.rs
push
called by 63
lewp-selectors/sink.rs
iter
called by 62
lewp-selectors/parser.rs
serialize_dimension
called by 20
lewp-css/src/serializers/serialize_dimension.rs

Shape

Method 1,120
Class 143
Function 116
Enum 81
Interface 36

Languages

Rust100%

Modules by API surface

lewp-selectors/parser.rs130 symbols
lewp-css/src/domain/numbers/css_unsigned_integer.rs37 symbols
lewp-css/src/domain/numbers/css_unsigned_number.rs34 symbols
lewp-css/src/domain/numbers/css_signed_number.rs33 symbols
lewp-selectors/bloom.rs32 symbols
lewp-css/src/domain/units/length_unit.rs28 symbols
lewp-css/src/domain/units/percentage_unit.rs24 symbols
lewp-selectors/matching.rs23 symbols
lewp-selectors/builder.rs23 symbols
lewp-css/src/domain/units/time_unit.rs23 symbols
lewp-css/src/domain/units/resolution_unit.rs23 symbols
lewp-css/src/domain/units/length_or_percentage_unit.rs23 symbols

For agents

$ claude mcp add lewp-rs \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page