All Projects → brokolja → laststaticsitegenerator

brokolja / laststaticsitegenerator

Licence: other
After learning how to use task runners like grunt, gulp, webpack and many static site generators i was in need for one workflow that makes setting up any tools unnecessary. Here it is!

Programming Languages

HTML
75241 projects
javascript
184084 projects - #8 most used programming language
CSS
56736 projects

Projects that are alternatives of or similar to laststaticsitegenerator

wowchemy-hugo-themes
🔥 Hugo website builder, Hugo themes & Hugo CMS. No code, easily build with blocks! 创建在线课程,学术简历或初创网站。#OpenScience
Stars: ✭ 6,891 (+49121.43%)
Mutual labels:  static-site-generator
plain
network .md into .html with plaintext files
Stars: ✭ 70 (+400%)
Mutual labels:  static-site-generator
reflect
Static site generator for WordPress.
Stars: ✭ 19 (+35.71%)
Mutual labels:  static-site-generator
tinyjam
A radically simple, zero-configuration static site generator in JavaScript
Stars: ✭ 137 (+878.57%)
Mutual labels:  static-site-generator
yass
Yet Another Static Site (Generator)
Stars: ✭ 18 (+28.57%)
Mutual labels:  static-site-generator
minipress
💁‍♂️ miniPress – a static site generator
Stars: ✭ 17 (+21.43%)
Mutual labels:  static-site-generator
sitio
imperative static site generator powered by React and browserify
Stars: ✭ 49 (+250%)
Mutual labels:  static-site-generator
refabricator
Static Site Generator for/in ReasonML
Stars: ✭ 31 (+121.43%)
Mutual labels:  static-site-generator
hugy
Hugy is an Electron desktop app acting as a GUI for the Hugo static site generator.
Stars: ✭ 44 (+214.29%)
Mutual labels:  static-site-generator
nene
Nēnē: A no-frills static site generator
Stars: ✭ 22 (+57.14%)
Mutual labels:  static-site-generator
roadbike
小书匠官网博客源码
Stars: ✭ 46 (+228.57%)
Mutual labels:  static-site-generator
readme-in-static-site
💎 Transform and insert your GitHub readme in your static site.
Stars: ✭ 24 (+71.43%)
Mutual labels:  static-site-generator
gpp
General PreProcessor
Stars: ✭ 25 (+78.57%)
Mutual labels:  static-site-generator
coltrane
A simple content site framework that harnesses the power of Django without the hassle.
Stars: ✭ 57 (+307.14%)
Mutual labels:  static-site-generator
pokedex-nextjs
Get to know the different render methods that the Next.js framework provides by exploring Pokemons
Stars: ✭ 39 (+178.57%)
Mutual labels:  static-site-generator
grammer-blog
My personal blog about programming or random stuff. Made using Vue JS 2 and Gridsome as a jamstack framework for Vue JS. Hosted on vercel
Stars: ✭ 14 (+0%)
Mutual labels:  static-site-generator
urlzap
⚡️ Your own static URL shortener
Stars: ✭ 57 (+307.14%)
Mutual labels:  static-site-generator
gridsome-starter-default
🐣 Default starter for Gridsome
Stars: ✭ 35 (+150%)
Mutual labels:  static-site-generator
mpa-frontend-template
🔥 Template based on webpack, pug, stylus, es6, postcss for multi page applications
Stars: ✭ 27 (+92.86%)
Mutual labels:  static-site-generator
webping
🚦 Python script to monitor web pages.
Stars: ✭ 20 (+42.86%)
Mutual labels:  static-site-generator

LastStaticSiteGenerator

After learning how to use task runners like grunt, gulp, webpack and many static site generators i was in need for one workflow that makes setting up any tools unnecessary. So my first mission was to find tools that require minimal or no configuration for all parts of my frontend-workflow. The first tool must be a static-site-generator for creating multi-page websites. The second tool is an asset-bundler that just handles any file i put into my websites like .css, .js, .ts, .vue and all my node_modules from npm. The last third tool should pick up all generated files and transform them into a fancy progressive-web-app (pwa) with offline-support and everything just done with support for multiple languages.

After testing many fancy tools i found the following three to be the best for my use-case:

  • Static-site-generator: Eleventy
  • Asset-bundler: Parcel
  • PWA-generator: Workbox

I tried to turn my new toolset in a row via simple npm-scripts. First generate static websites with Eleventy. Than Parcel automatically extracts, transforms and even downloads all needed assets from the static websites to create some bundles. At last Workbox comes in to the game and does its magic to generate a minfied PWA with all batteries included from these bundles.

I finally got things working and i did not need any other setup in the last few projects. No matter if its react, vue or some good old jquery. So if this can make me happy i think it must be shared...

Setup

Get https://nodejs.org and use a Unix/Linux system because i have not tested this on win.

Installation

  1. Clone this repository:
git clone https://github.com/koljakutschera/laststaticsitegenerator.git
  1. Open a terminal and run:
npm install

Development

To generate, bundle and serve the site on: http://localhost:1234/index.html open a terminal and run:

npm run dev

or with https enabled:

npm run dev:https

I18n

Language files are located at: locales/ using ISO-Codes as filename.

To set the language in development use the environment variable: ELEVENTY_LOCALE in front of npm commands. If you add new languages add them in package.json to all ELEVENTY_LOCALES environment variables.

Example: Set available locales (package.json)

ELEVENTY_LOCALES=(en de)

Example: Set current dev locale

ELEVENTY_LOCALE=de npm run dev

Production

To generate a minified production-bundle open a terminal and run:

npm run production

or the same with multiple languages:

production:i18n

To generate the minified production-bundle as PWA open a terminal and run:

npm run production:pwa

or the same with multiple languages:

production:pwa:i18n

To just serve the production-bundle from "dist"-directory on localhost open a terminal and run:

npm run serve

Getting started

If you are ready for coding check the "site"-directory which contains some example files. Now its time to read the very short/good eleventy and parcel documentations. You can adjust everything workflow related in package.json's scripts section.

Getting started with PWA

If you want to generate a PWA in production you can adjust the following files to your needs:

  • site/_data/metadata.json
  • site/manifest.njk
  • site/_assets/manifest-192.png
  • site/_assets/manifest-512.png

Advanced users can use: workbox-config.js to configure how the PWA builds. For more infos see: https://developers.google.com/web/tools/workbox/

Supported technologies

HTML, Markdown, Liquid, Nunjucks, Handlebars, Mustache, EJS, Haml, Pug, and JavaScript Template Literals, Javascript, ReasonML, CSS, SCSS, LESS, Stylus, HTML, TypeScript, CoffeeScript, Vue, JSON, GraphQL, Rust, WebAssembly, YAML, TOML, OpenGL, Pug, WebManifest, ...

Some fancy features

  • no plugins
  • code splitting
  • filesystem cache
  • minimal configuration
  • multicore compilation
  • hot module replacement
  • out of the box support for everything*
  • use legancy scripts and node_modules side by side

More documentation

Eleventy: https://github.com/11ty/eleventy

Parcel: https://parceljs.org/

Workbox: https://developers.google.com/web/tools/workbox/

FAQ

Why no subdirectories/folder-urls

By default Eleventy creates subdirectories/folder-urls when generating pages but because Parcel cant work with them i used a little hack or better a feature (permalinks) of Eleventy itself to rewrite all pages to the root directory. Maybe this will be fixed by Parcel in feature.

What are the .cache, .cache_eleventy, .cache_parcel directories for?

Temporary files. Just ignore them.

Troubleshooting

Build error in development

When the development task is started first parcel needs to wait for eleventy to build pages. This usually takes < 1 second but if you have thousends of pages it can take a little more time. In this case you can adjust the time parcel has to wait for eleventy in package.json. Look for "sleep 3" and adjust it to the time eleventy shows you in the console. For example eleventy shows: Processed 7000 files in 5.28 seconds so you should put something like sleep 6 in package.json.

I see nothing on: http://localhost:1234/

Append your pages filename to the URL for example: index.html = http://localhost:1234/index.html

PWA Manifest not served

Make sure your server uses: application/manifest+json MIME-Type for .webmanifest file.

Serviceworker not loaded

The serviceworker will not load on local domains (localhost/127.0.0.1).

Page not generated

This is because parcel does not(now) work with sub-directories(or folders-URLs) created by eleventy. To fix this we rewrite permalinks in eleventy from: /filename/index.html to /filename.html via eleventy's global-data-file feature(see site/_data/permalink.js). You can overwrite the default permalinks via yamlfront in a template but you have to make sure that its not rendered to a sub-directory. The following will not work for example:

---
permalink: subdirectory/filename.html
---

But this will work:

---
permalink: filename.html
---
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].