Crates.io | basi_css |
lib.rs | basi_css |
version | 0.2.22 |
source | src |
created_at | 2024-10-17 18:52:25.322923 |
updated_at | 2024-10-18 14:36:57.170948 |
description | CSS framework using tiny_http |
homepage | |
repository | https://github.com/LemonsSquirrel/BasiCss |
max_upload_size | |
id | 1413519 |
size | 72,444 |
A CSS framework insipred by Tailwind CSS.
This project is still in development, use it with another CSS file to complement it for now, i will try to do frequent updates! But, for now, Enjoy! Feel free to tell me if you find any problem with the README, i will try to update it for other http frameworks as well.
main.rs
use tiny_http::{Server, Request, Response};
// import the module
use basi_css::serve_css;
fn main() {
// We create the server
let server = Server::http("127.0.0.1:8080").unwrap();
println!("Server started at http://127.0.0.1:8080");
for request in server.incoming_requests() {
// If the request is for the css file, we serve it
if request.url() == "/css/basicss.css" {
let response = serve_css(request);
server.respond(response).unwrap();
} else {
// Otherwise, we respond with a 404 error.
server.respond(Response::from_string("404 Not Found".to_string())).unwrap();
}
}
}
index.html
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="/css/basicss.css">
</head>
<body>
<nav class="navbar navbar-dark"></nav>
<main class="width-100-percents height-100-percents flex justify-center width-100-percents flex-column" >
<h1>Hello, World!</h1>
</main>
<footer class="footer footer-dark"></footer>
</body>
</html>