Skip to content

This is a lightweight Static Site Generator (SSG) library for Stratox that transforms dynamic content into static HTML, optimizing your site for search engines.

License

Notifications You must be signed in to change notification settings

stratoxjs/StratoxSSG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Stratox - Static Site Generator (SSG)

The Stratox Static Site Generator (SSG) is a lightweight tool that transforms your dynamic Stratox application into static HTML files. This approach enhances site performance, boosts SEO, and makes deployment a breeze.


Features

  • Flexible Configuration: Customize the build process with options for port, host, and SSL.
  • Dynamic to Static: Generate static HTML files for specific routes.
  • SEO-Friendly: Optimized output for better search engine visibility.

Prerequisites

  1. Ensure Node.js is installed on your system.
  2. Install Stratox SSG via npm:
npm install @stratox/ssg --save-dev

Usage Guide

Step 1: Define Routes for Static Generation

Edit your vite.config.js file to specify the paths you want to generate as static HTML.

import { defineConfig } from 'vite';

export default defineConfig({
  stratoxSSG: {
    paths: [
      '/',
      '/about',
      '/contact'
    ]
  }
});

Step 2: Generate Static Files

Run the following commands to build your static files:

  1. Basic Build:

    npx ssg build

    This command generates static files and outputs them to the dist directory.

  2. Custom Port: To specify a custom port for the build script to access, use:

    npx ssg build --port 5193
  3. Custom Host: To specify a custom host for the build script, use:

    npx ssg build --host example.test
  4. Enable HTTPS: To use HTTPS for the build script, add the --ssl option:

    npx ssg build --ssl true

Step 3: Deploy Your Static Site

After building your static files, deploy the contents of the dist directory to your preferred hosting platform (e.g., Netlify, Vercel, or your own server).


Example Directory Structure

After running the ssg build command, your project directory might look like this:

project-root/
├── dist/
│   ├── assets/
│   ├── index.html
│   ├── about.html
│   └── contact.html
├── src/
├── vite.config.js
└── package.json

Advanced Tips

  • Automated Builds: Add the build command to your package.json scripts for easier execution:
    "scripts": {
      "build:ssg": "ssg build"
    }
    Then run:
    npm run build:ssg

About

This is a lightweight Static Site Generator (SSG) library for Stratox that transforms dynamic content into static HTML, optimizing your site for search engines.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published