stephancasas / presto Goto Github PK
View Code? Open in Web Editor NEWHTML componentization, specialized for Alpine JS.
License: MIT License
HTML componentization, specialized for Alpine JS.
License: MIT License
Hi @stephancasas. So, my boilerplate with the component based structure is coming on nicely. I have, however, decided to swap out rollup with Vite, for build and bundling. Everything works really well. I just want some advice on one item, when including presto in my build chain.
Vite relies on the index.html
file as its starting point. So, before adding presto to my app, the build would basically do the following:
index.html
from the src
folderindex.js
in the src
folder, which is embed in the index.html
file, and does all the js imports, bundling, etc, etcindex.html
) to the list
folderAll of this works 100%.
Now, when including presto in my project, I will have a situation whereby both presto and vite need to make changes to the index.html
. The only way I can see around this is:
src
(example app.html
)presto.config.js
to look something like this:export default {
input: 'src/app.html',
output: {
file: 'src/index.html',
formatting: 'none'
}
}
"build:markup": "presto --config presto.config.js",
"build:bundle": "vite build",
"build": "npm-run-all build:markup build:bundle"
index.html
that vite will use to build and bundleDoes this make sense? Can you think of an easier/better way to achieve this?
I'm trying to find a middle ground between a static site generator and hand-crafted html. I was wondering whether it is possible to create a folder (e.g. blog-posts/) and have presto traverse that whole folder and output all the files into ./dist ?
Basically, presto.config.js contain something like this:
{
input: 'src/blog-posts/*.html',
include: [
'src/components/**/*.html',
],
output: {
file: 'dist/blog/*.html',
}
}
Really keen to give this lib a try! Well done!
I want to also split my alpine js logic, similar to how you do withe the HTML views., i.e. having a folder structure similar to the following:
src
|--components
| |--my-content
| |--index.html
| |--index.js
| |--my-footer
| |--index.html
| |--index.js
| |--my-header
| |--index.html
| |--index.js
|--index.html (this is the main entry point)
My questions:
index.js
that is included in the main index.html
?First of all, thank you for creating this!
When I try and bundle this code with npx presto
./src/app.html
<meta presto name="App">
<main class="container mx-auto px-2 md:px-0">
<div x-data="{options: ['date', 'price', 'relevance']}">
<select>
<template x-for="selection in options" :key="selection">
<option :value="selection" x-text="selection"></option>
</template>
</select>
</div>
</main>
./src/index.html
<!doctype html>
<link presto href="./app.html">
<body class="antialiased bg-gray-100 font-sans text-gray-700 ">
<App />
</body>
</html>
this is being rendered:
./index.html
<html>
<head></head>
<body>
<main class="container mx-auto px-2 md:px-0">
<div x-data="{options: ['date', 'price', 'relevance']}">
<select>
<option :value="selection" x-text="selection"></option>
</select>
</div>
</main>
</body>
</html>
As you can see, the template x-for
loop is missing.
Is this intended behaviour and did I miss something or is this a bug?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.