Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@benev/turtle

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@benev/turtle

static site generator

  • 0.0.0-dev.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
69
decreased by-21.59%
Maintainers
1
Weekly downloads
 
Created
Source

🐢 @benev/turtle

slow and steady static site generator

  • turtle is a one-line command that generates a website
  • you write html templates in plain javascript
  • templates are just async functions, so you can do anything
  • you can kind of imagine it like some kind of static javascript "php"
  • turtle also copies other files like css and whatnot

turtle turtorial


run turtle to generate a website

npx @benev/turtle --in="s/demo:x/demo" --out="x/demo" --verbose="true"

image: turtle example output


ask turtle for help

npx @benev/turtle +help

image: turtle help page


write your first webpage template, like index.html.js

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>
`)

you've gotta get into hash versioning!

  • that's what the above example is doing with that v function
  • you use v on your urls, and v will attach that file's hash as a suffix
  • so /style.css becomes /style.css?v=c252882f
  • now when you deploy your site, your users won't see old cached css files that break your website -- now the browser cache becomes version aware! 🤯

remember, the templates are just async js functions

  • so you can import other modules, read and write files, whatever you want

i'm thinking of adding more turtle functionality later..

  • context.turtle.js could return a context object that is passed to all templates
  • some smart way to add custom build scripts that can, like, build a whole directory of yamls or markdowns or whatever, and generate a ton of pages (as opposed to being limited to just one .html.js per generated page)

Keywords

FAQs

Package last updated on 17 May 2023

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc