@stratox/ssg
v1.1.0
Published
This is a lightweight Static Site Generator (SSG) library for Stratox that transforms dynamic content into static HTML, optimizing your site for search engines.
Downloads
8
Maintainers
Readme
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
- Ensure Node.js is installed on your system.
- Install Stratox SSG via npm:
npm install @stratox/ssg --save-devUsage 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:
Basic Build:
npx ssg buildThis command generates static files and outputs them to the
distdirectory.Custom Port: To specify a custom port for the build script to access, use:
npx ssg build --port 5193Custom Host: To specify a custom host for the build script, use:
npx ssg build --host example.testEnable HTTPS: To use HTTPS for the build script, add the
--ssloption: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.jsonAdvanced Tips
- Automated Builds: Add the build command to your
package.jsonscripts for easier execution:
Then run:"scripts": { "build:ssg": "ssg build" }npm run build:ssg
