GithubHelp home page GithubHelp logo

thedevdojo / static Goto Github PK

View Code? Open in Web Editor NEW
154.0 4.0 12.0 489 KB

⚡️ The ultimate static site generator. Tailor-made for killer blogs, sizzling SaaS landings, audacious personal sites, and every web fantasy you dare to dream up.

Home Page: https://static.devdojo.com

License: MIT License

JavaScript 84.13% HTML 15.87%
generator html site ssg static website

static's Introduction

⚡️ Static - The Pure Power of Simplicity.

github cover

A static site generator you're going to love. No more complicated configs, bloated frameworks, or feeling like you got kicked in the face by a horse! Here's the spiel:

  • Static is easy.
  • HTML is easy.
  • Yet, somehow we lost the art of crafting simple Static HTML websites

No longer will this stand! Static is here to reclaim the throne of simplicity!

🛠️ Setup in a Snap

Make sure you have Node installed on your machine, and then copy/paste the following command in your terminal:

npm install -g @devdojo/static

Now you'll have the static command available on your machine, allowing you to run the following:

  • static new folder-name - Create a new website with the static starter template
  • static dev - Start up a dev environment of your static website
  • static build - Build a production ready version of your website (available in the _site directory)

Next, head on over to the official documentation to learn more about building your site.

🖐️ Five reasons this might just be your jam!

1. Page-based Routing

Each file within the pages directory corresponds to a route on your website. With a structure like this:

pages
├── index.html
├── about.html
├── contact
│   ├── index.html
│   ├── form
│   │   ├── index.html

Your new site will have the following routes available:

http://localhost:3000
http://localhost:3000/about
http://localhost:3000/contact
http://localhost:3000/contact/form

2. Layouts

Design layouts that multiple pages can utilize.

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{title}</title>
</head>
<body>
    {slot}
</body>
</html>

Then, use it in any page.

<layout title="Radical Righteousness" src="main.html">

    <h1>🏄‍♂️ Totally Tubuloso Website</h1>
    
</layout>

3. Includes

Create re-usable HTML partials with the <include> tag. Specify the HTML file with the src attribute.

<layout title="Behind the Scenes!" src="main.html">

    <include src="about-header.html"></include>
    <include src="about-copy.html"></include>

</layout>

4. TailwindCSS Integration

Add the TailwindCSS shortcode to the <head> of any layout and it will automatically be injected. Example:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>{title}</title>
    {tailwindcss}
</head>
<body>
    {slot}
</body>
</html>

It will be replaced with the Tailwind CDN link in dev, and a minified CSS file will be compiled during build.

5. Collections

Add collections of data to your application. Here's an example collection located at collections/menu.json

[
    {
        "title" : "Home",
        "link" : "/"
    },
    {
        "title" : "About",
        "link" : "/about"
    }
]

Now, you can easily loop through this collection:

<ForEach collection="menu">
    <li>{menu.title}</h1>
</ForEach>

Those are just a few of the hot features available, but there's so much more to uncover and learn.

Learn More

You can learn about all the features available in Static by visiting the official documentation. You may also be interested in checking out some of the templates here.

Static HTML is King 👑

static's People

Contributors

bobbyiliev avatar ma2t avatar tnylea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

static's Issues

issues with self closing tag, space between start and end dag, and using {slot} inside component

Hey, and thanks for this static generator. I tried it yesterday and found a few annoying things that does not look quite right:

  • using self closing tag for include does not work
  • having a space between start and ende include tag makes the component not render. If there are many attributes in a tag, it is useful to split it in multiple lines, and then it easily breaks, like this:
<include 
    src="message.html"
>
</include>
  • I found it really strange that an include cannot have a slot. Like:
<include src="message.html">Some content</include>
<!-- inside the include message.html above -->
<div>{slot}</div>

Also, using the content folder using markdown files does not seem to render as it should with auto url mapping. I tried the docs example on you website, but pages/index.html seems to be rendered anyway, but without a 404, so it looks like it finds the correct file. Just the rendering seems wrong

Failed to create project due to null value of "global-modules-path"

Node.js v20.16.0
npm v10.8.1

When I tried to create a new project using: static new blog --aria
The error log shows:

D:\workspace\js>static new blog --aria
New setup initialized
Downloading aria template
Finished downloading template
Extracting template zip file
Finished unzipping
New site available inside blog folder
spawnSync npm.cmd EINVAL
node:internal/modules/cjs/loader:1148
  throw err;
  ^

Error: Cannot find module 'null/src/dev.js'
Require stack:
- C:\Users\flik\AppData\Roaming\npm\node_modules\@devdojo\static\src\new.js
- C:\Users\flik\AppData\Roaming\npm\node_modules\@devdojo\static\bin\static
    at Module._resolveFilename (node:internal/modules/cjs/loader:1145:15)
    at Module._load (node:internal/modules/cjs/loader:986:27)
    at Module.require (node:internal/modules/cjs/loader:1233:19)
    at require (node:internal/modules/helpers:179:18)
    at C:\Users\flik\AppData\Roaming\npm\node_modules\@devdojo\static\src\new.js:50:37
    at next (C:\Users\flik\AppData\Roaming\npm\node_modules\@devdojo\static\node_modules\rimraf\rimraf.js:72:7)
    at CB (C:\Users\flik\AppData\Roaming\npm\node_modules\@devdojo\static\node_modules\rimraf\rimraf.js:108:9)
    at FSReqCallback.oncomplete (node:fs:187:23) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\flik\\AppData\\Roaming\\npm\\node_modules\\@devdojo\\static\\src\\new.js',
    'C:\\Users\\flik\\AppData\\Roaming\\npm\\node_modules\\@devdojo\\static\\bin\\static'
  ]
}

Then I modified the new.js to log the output of the getPath function to see what it returns:

const path = require("global-modules-path").getPath("@devdojo/static");
console.log('Module path:', path); 

The output of Module path is null.

I've reinstall the global-modules-path,but it's still not working.
I can only temporarily manually assign the devServer path to solve this problem.
image

Congrats + a first question :)

Hi,

Congrats! I love this idea and will try Static asap.
From what I've seen, it could fulfill my needs.

The only extra thing I need is to fetch content from Airtable for example.
The output is in json format so it should be ok.
What would be the Static way of fetching json content and using it?

Finally, there is a little catch with "Airtable markdown flavor".
For now, I use a custom component to render Airtable markdown.
I use the "marked" package with this options:

marked.use({
  breaks: true,
  gfm: true,
});

What would be the Static way of doing this?

Thanks in advance.
I'm really excited by Static and would love to drop all these overkill frameworks!

Best regards.

Wrong install command for templates in templates GitHub repo

Hi,

I just noticed that the template install command is good in the Templates page or in the templates preview topbar but wrong at the bottom of the templates GitHub repo:

static new folder-name --template=stone

I guess it was the initial command that have been simplified but not corrected in the templates repo ;)

the version of Node

I want to know the version of Node.js I am using. Currently, I am using version 20, but there are some errors.

Can not install

npm install -g @devdojo/static

npm warn deprecated [email protected]: This module is not supported, and leaks memory. Do not use it. Check out lru-cache if you want a good and tested way to coalesce async requests by a key value, which is much more comprehensive and powerful.
npm warn deprecated [email protected]: Rimraf versions prior to v4 are no longer supported
npm warn deprecated [email protected]: Removed event-stream from gulp-header
npm warn deprecated [email protected]: Glob versions prior to v9 are no longer supported
npm warn deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm warn deprecated [email protected]: Please upgrade to v9.0.0+ as we have fixed a public vulnerability with formidable dependency. Note that v9.0.0+ requires Node.js v14.18.0+. See ladjs/superagent#1800 for insight. This project is supported and maintained by the team at Forward Email @ https://forwardemail.net

SASS support

Maybe add a plugin or something to support SASS??? I want to have sass files alongside my html in pages folder... What can I do?

Tailwind @apply is not working on 'static dev' but works in built

When developing locally, in main.css

@layer components {
    .button {
        @apply text-neutral-200 hover:bg-white/5 border-white/20 hover:text-white;
    }
}

The style is not applied, but after built, the style is applied properly.

Upon inspecting the injected style tag doesn't have type="text/tailwindcss" like the official Tailwind documentation suggested.

Could this be an issue?

Updating main.css doesn't trigger live reload

Editing /assets/css/main.css. Trying to add custom styles after /* Add Your Custom CSS Here */ comment line. Server is running, yet editing main.css file doesn't trigger a live-reload. Editing any html or even /assets/js/main.js does trigger live reload. Is this expected?

New Website Initialization Fails, Missing package.json

First off, thank you for creating such an innovative project; the concept is fantastic!
I've run into an issue while trying to initialize a new website, and I was hoping you could help me resolve it.

I tried to create a new website using the static new test-website command. The process failed with an error stating that package.json is missing in the directory. Only a package-lock.json and a starter-main folder were generated.
Steps to Reproduce:

  • Run static new test-website
  • Observe the error regarding missing package.json

Expected Behavior:

A new website should be initialized with all the required files, including package.json.
Actual Behavior:

The test-website folder was created, but it only contains:

  • package-lock.json
  • starter-main folder

Error Log:

Error building assets, please re-run static dev command.
Error: Command failed: cd /home/matt/test-website && npm install && static build
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/matt/test-website/package.json
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/matt/test-website/package.json'
...

Environment:

  • Node version: v18.18.0
  • npm version: 9.8.1

Reverse ordering of collections

Hi!

I was wondering whether it was possible to reverse the order of a collection? I'm trying to show blog posts from latest to oldest but for some reason I'm not able to do it. Any help is appreciated.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.