Comments (6)
What's the error? Do you get a blank page, any errors in the console?
from leaf-kit.
empty page.
from leaf-kit.
Anything in the console, any logs etc? Have you tried removing parts of the template to see what breaks it? Going to need more to go on here
from leaf-kit.
Also do you get any generated HTML? Even if the page is blank
from leaf-kit.
finally got it working
application.leaf
<!DOCTYPE html>
<html lang="en">
<head>
<title>#(title)</title>
<!-- bootstrap -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-YvpcrYf0tY3lHB60NNkmXc5s9fDVZLESaAA55NDzOxhy9GkcIdslK1eN7N6jIeHz" crossorigin="anonymous"></script>
<meta name="csrf-token" content="#(csrfToken)">
</head>
<body>
<main class="container-sm">
#extend("Layouts/header")
#import("content")
</main>
#extend("Layouts/footer")
<script>
document.addEventListener('DOMContentLoaded', function() {
const token = document.querySelector('meta[name="csrf-token"]').getAttribute('content');
document.querySelectorAll('form').forEach(function(form) {
form.addEventListener('submit', function(event) {
const input = document.createElement('input');
input.type = 'hidden';
input.name = 'csrf_token';
input.value = token;
form.appendChild(input);
});
});
});
</script>
</body>
</html>
header.leaf
<nav class="navbar navbar-expand-lg bg-body-tertiary">
<a class="navbar-brand" href="/">LOGO</a>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav me-auto mb-2 mb-lg-0">
<li class="nav-item">
<a class="nav-link active" aria-current="page" href="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/about">About us</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/privacy">Privacy</a>
</li>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
Dropdown
</a>
<ul class="dropdown-menu">
<li><a class="dropdown-item" href="#">Action</a></li>
<li><a class="dropdown-item" href="#">Another action</a></li>
<li><hr class="dropdown-divider"></li>
<li><a class="dropdown-item" href="#">Something else here</a></li>
</ul>
</li>
</ul>
</div>
</nav>
and index.leaf
#extend("Layouts/application")
<div class="container">
<h1>Hello #(companyName)</h1>
</div>
The documentation is incorrect/incomplete regarding syntax for extend and export and import.
for each website a structure with subview is required like header, footer, sidemenu and main content
footer.leaf
<footer class="bg-dark text-white text-center py-3 mt-auto fixed-bottom">
<div class="container">
<p>© 2024 #(companyName). All rights reserved.</p>
</div>
</footer>
from leaf-kit.
What did you fix? It's hard to tell here. Feel free to submit a PR to the docs!
from leaf-kit.
Related Issues (20)
- Subclassing for context is not working HOT 3
- Allow `#import` to be empty or not declared
- Conditional operands do not seem to evaluate lazily
- Custom tags with body HOT 2
- Add modulo (%) infix operator HOT 3
- Hashtag character is not allowed to start the value of a data attribute HOT 3
- Leaf-kit cannot render the page with AppCode from JetBrains HOT 7
- LeafCache is public but not implementable
- Consider supporting ranges in the template loop tag
- Add support for minification or prettification of Leaf's final output HOT 1
- Xcode Warnings on Xcode 13.3 HOT 2
- Add ability to loop though dictionaries
- Provide a way to dump the current context as JSON via a tag
- Public visibility for `LeafData.lazy(...)` to build LeafData lazily from a closure HOT 4
- Add a `#routes` or `#link_to` Tag HOT 2
- Allow to add quotes into stringLiteral parameters HOT 2
- `requireBody()` and `requireNoBody()` not working as expected
- `#extend` with two parameters doesnโt pass second parameter as context when nested
- `#extend` not rendered when wrapped by `#with`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from leaf-kit.