
Security News
Deno 2.2 Improves Dependency Management and Expands Node.js Compatibility
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
@benev/turtle
Advanced tools
@benev/turtle
slow and steady static site generator
note, turtle doesn't care whether you use typescript or plain javascript, but in the examples here i'll be using the two interchangeably.
npx @benev/turtle --in="s/demo:x/demo" --out="x/demo" --verbose="true"
npx @benev/turtle --help
index.html.js
turtle will sniff out your .html.js
files, and render them into html pages.
import {webpage, html} from "@benev/turtle"
export default webpage(async({v}) => html`
<!doctype html>
<html>
<head>
<title>@benev/turtle</title>
<link rel="stylesheet" href="${v("/style.css")}"/>
</head>
<body>
<h1>@benev/turtle</h1>
</body>
</html>
`)
it can accept a context object
you tell turtle to ignore it with --exclude="**/*.partial.html.js"
page.partial.html.ts
import {webpage, html} from "@benev/turtle"
export default webpage<{x: number}>(async({v}, {x}) => html`
<!doctype html>
<html>
<head>
<meta charset="utf-8"/>
<title>@benev/turtle - stamp test</title>
<link rel="stylesheet" href="${v("/style.css")}"/>
</head>
<body>
<h1>@benev/turtle - stamp test</h1>
<p>${x}</p>
</body>
</html>
`)
stamp.turtle.js
turtle also sniffs out .turtle.js
scripts and executes them.
in these, you can do anything you want. your turtle script function is provided some handy stuff like the write_webpage
function.
stamp.turtle.ts
import {turtle_script} from "@benev/turtle"
// import the partial from the previous example
import page from "./page.partial.html.js"
// we'll stamp out a webpage for each of these values
const values = [1, 2]
// your default export must be a turtle_script
export default turtle_script(async({write_webpage}) => {
// loop over each value
await Promise.all(values.map(async(x) => {
// write a webpage
await write_webpage({
// provide the page template
template: page,
// provide the x value in the context
context: {x},
// specify the destination relative
// to this build script
destination: `${x}.html`,
})
}))
})
v
functionv
on your urls, and v
will attach that file's hash as a suffix/style.css
becomes /style.css?v=c252882f
.html.js
per generated page)FAQs
static site generator
The npm package @benev/turtle receives a total of 0 weekly downloads. As such, @benev/turtle popularity was classified as not popular.
We found that @benev/turtle demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Deno 2.2 enhances Node.js compatibility, improves dependency management, adds OpenTelemetry support, and expands linting and task automation for developers.
Security News
React's CRA deprecation announcement sparked community criticism over framework recommendations, leading to quick updates acknowledging build tools like Vite as valid alternatives.
Security News
Ransomware payment rates hit an all-time low in 2024 as law enforcement crackdowns, stronger defenses, and shifting policies make attacks riskier and less profitable.