static-site-builder 0.1.4 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +18 -85
- data/README.md +87 -309
- data/bin/generate +3 -40
- data/exe/static-site-builder +1 -40
- data/lib/generator.rb +613 -822
- data/lib/static_site_builder/builder.rb +266 -461
- data/lib/static_site_builder/dev_server.rb +119 -0
- data/lib/static_site_builder/version.rb +1 -1
- data/lib/static_site_builder/websocket_server.rb +97 -21
- data/lib/static_site_builder.rb +17 -4
- metadata +28 -14
- data/ARCHITECTURE.md +0 -61
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b04601a6add58d7ee3a23a48d6456f16fd6fb09a486d1834604803b21cd2ca75
|
|
4
|
+
data.tar.gz: 717cfe27a34a388acea7a1f91a37b655040dc7ca1b97d4d6fe86c01c59d10f17
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 28c976044449130ad0da918875dfdfdbc32b09126f46f4ed2516b3d72fd0107ed8f63a6891c09414f37d13acee61f1c573ed1e40ad6c81f87a49628013037fdf
|
|
7
|
+
data.tar.gz: 6ae711f3f6fb8de54c2b2ec4f9b8c3bfbd2d4b6d8848ff078f95e3c0174523e0e9542779d1b331b0541c6c8fdcca6241bfd35b16d1d31cbfae29568d262592a4
|
data/CHANGELOG.md
CHANGED
|
@@ -1,96 +1,29 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 1.0.0 (Current) - 2025-12-13
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
5
|
+
First stable release of Static Site Builder.
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
### Features
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
- `build:sitemap` task is automatically added to generated Rakefiles
|
|
15
|
-
- Sitemap generation is integrated into `build:all` task
|
|
9
|
+
- Generate static HTML sites from ERB templates
|
|
10
|
+
- Development server with auto-rebuild and live reload
|
|
11
|
+
- Sitemap generation from pages
|
|
12
|
+
- Simple and flexible - add your own JavaScript bundling and CSS processing
|
|
16
13
|
|
|
17
|
-
###
|
|
18
|
-
- Page metadata is now managed via `PageHelpers::PAGES` hash instead of frontmatter
|
|
19
|
-
- README updated to reflect `PageHelpers::PAGES` approach (frontmatter example removed)
|
|
20
|
-
- ActionView requirement changed from `>= 8.0` to `~> 7.1` for Ruby 3.1 compatibility
|
|
21
|
-
- Generated layouts now use `@title` and `@js_modules` instance variables instead of frontmatter
|
|
14
|
+
### What Gets Generated
|
|
22
15
|
|
|
23
|
-
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
16
|
+
- Clean project structure with `app/views/`, `app/javascript/`, `app/assets/stylesheets/`
|
|
17
|
+
- Self-contained build code in `lib/site_builder.rb` (no runtime dependency on this gem), using ActionView for Rails-like templates/partials/helpers
|
|
18
|
+
- Rakefile with build tasks (`bundle exec rake build:all`, `bundle exec rake build:html`, `bundle exec rake build:css`, `bundle exec rake build:sitemap`)
|
|
19
|
+
- `build:all` cleans `dist/` first, then builds assets + HTML + CSS + sitemap
|
|
20
|
+
- Development server (`bundle exec rake dev:server`) with live reload
|
|
21
|
+
- Example pages and layouts
|
|
22
|
+
- Sitemap configuration
|
|
28
23
|
|
|
29
|
-
|
|
24
|
+
### Requirements
|
|
30
25
|
|
|
31
|
-
|
|
32
|
-
-
|
|
33
|
-
- Support for Rails-style render syntax: `render 'shared/header'` and `render partial: 'shared/header'`
|
|
34
|
-
- Support for passing locals to partials: `render partial: 'shared/header', locals: { title: 'Hello' }`
|
|
35
|
-
- Nested partial support (partials can render other partials)
|
|
36
|
-
- Multiple partials on the same page now work correctly
|
|
26
|
+
- Ruby 3.0+
|
|
27
|
+
- Bundler
|
|
37
28
|
|
|
38
|
-
### Changed
|
|
39
|
-
- Replaced raw ERB implementation with ActionView::Base for template rendering
|
|
40
|
-
- Render method now uses ActionView's rendering system, matching Rails behaviour exactly
|
|
41
|
-
- Partials automatically receive page variables (@js_modules, importmap_json, current_page)
|
|
42
|
-
- Improved error messages for missing partials (converted from ActionView format for backwards compatibility)
|
|
43
|
-
- Template annotations now preserve both page and layout annotations correctly
|
|
44
|
-
|
|
45
|
-
### Fixed
|
|
46
|
-
- Fixed issue where nested partials (partials rendering other partials) would fail or produce incorrect output
|
|
47
|
-
- Fixed issue where multiple partials on the same page would only render the last one
|
|
48
|
-
- Fixed template annotations being stripped when layout annotations were added
|
|
49
|
-
|
|
50
|
-
## [0.1.2] - 2025-11-22
|
|
51
|
-
|
|
52
|
-
### Fixed
|
|
53
|
-
- CSS directory is now always created when Tailwind handles CSS compilation, preventing 404 errors for stylesheets
|
|
54
|
-
- Build process now updates files in place instead of cleaning and recreating the dist directory, preventing 404 errors during rebuilds in development mode
|
|
55
|
-
- Fixed race condition where pages would return 404 when code changes triggered rebuilds
|
|
56
|
-
|
|
57
|
-
## [0.1.1] - 2025-11-21
|
|
58
|
-
|
|
59
|
-
### Added
|
|
60
|
-
- `render` helper method for ERB templates to include partials
|
|
61
|
-
- Support for rendering partials from `app/views/shared/` directory
|
|
62
|
-
- Partial files should be named with `_` prefix (e.g., `_header.html.erb`)
|
|
63
|
-
- Partials have access to page variables (@js_modules, etc.)
|
|
64
|
-
|
|
65
|
-
### Changed
|
|
66
|
-
- Improved ERB compilation to support partial rendering
|
|
67
|
-
|
|
68
|
-
## [0.0.1] - 2025-11-21
|
|
69
|
-
|
|
70
|
-
### Added
|
|
71
|
-
- Initial release of static-site-builder gem
|
|
72
|
-
- Generator for creating new static site projects
|
|
73
|
-
- Builder for compiling ERB templates to static HTML
|
|
74
|
-
- Support for multiple template engines (ERB, Phlex)
|
|
75
|
-
- Support for multiple JavaScript bundlers (Importmap, ESBuild, Webpack, Vite, None)
|
|
76
|
-
- Support for multiple CSS frameworks (TailwindCSS, shadcn/ui, Plain CSS)
|
|
77
|
-
- Support for multiple JavaScript frameworks (Stimulus, React, Vue, Alpine.js, Vanilla)
|
|
78
|
-
- Page metadata via `PageHelpers::PAGES` hash
|
|
79
|
-
- Layout support with nested layouts
|
|
80
|
-
- Importmap JSON generation
|
|
81
|
-
- Asset copying (JavaScript, CSS, vendor files, static files)
|
|
82
|
-
- Comprehensive test suite
|
|
83
|
-
- YARD documentation
|
|
84
|
-
- CI/CD setup (GitHub Actions)
|
|
85
|
-
|
|
86
|
-
### Changed
|
|
87
|
-
- Vendor JavaScript files are automatically copied directly from `node_modules` to `dist/assets/javascripts/` during build
|
|
88
|
-
- Removed requirement for `vendor/javascript/` folder - vendor files are copied automatically based on importmap configuration
|
|
89
|
-
- Generator no longer creates vendor files during project generation
|
|
90
|
-
|
|
91
|
-
### Fixed
|
|
92
|
-
- Added warning messages when vendor files cannot be found in `node_modules`
|
|
93
|
-
- Updated base64 dependency comments to clarify requirement for Ruby 3.4+
|
|
94
|
-
|
|
95
|
-
[0.0.1]: https://github.com/Ancez/static-site-builder/releases/tag/v0.0.1
|
|
96
29
|
|
data/README.md
CHANGED
|
@@ -1,15 +1,28 @@
|
|
|
1
1
|
# Static Site Builder
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
> **⚠️ Active Development**: This project is currently in active development.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
A Ruby-based generator and builder for creating static HTML sites with working JavaScript. **No backend required** - just compile your ERB files to static HTML and deploy anywhere.
|
|
6
|
+
|
|
7
|
+
📖 **Learn more**: [Demo](https://lukaszczapiewski.com) | [Project Overview](https://lukaszczapiewski.com/projects/static-site-builder) | [Getting Started Guide](https://lukaszczapiewski.com/blog/getting-started-with-static-site-builders)
|
|
8
|
+
|
|
9
|
+
## Why This Exists
|
|
10
|
+
|
|
11
|
+
Generates standalone static sites from ERB templates, with a working dev server, file watching, and live reload. Generated projects are **self-contained**: the build code lives in the generated repo (`lib/site_builder.rb`).
|
|
12
|
+
|
|
13
|
+
## Why Choose This Over Other Approaches
|
|
14
|
+
|
|
15
|
+
**Better SEO & Search Rankings**: Unlike Single Page Applications (SPAs) that rely on client-side JS rendering, static HTML is immediately crawlable by search engines. Your content is fully indexed from the first request, leading to better search rankings and significantly faster page loads.
|
|
6
16
|
|
|
7
|
-
|
|
17
|
+
**Simplicity Over Complexity**: No need for complex JavaScript frameworks, hydration, or server-side rendering setups. Create .html.erb files that compile to clean, static HTML. Add JavaScript only where you need interactivity, not as a requirement for rendering.
|
|
8
18
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
19
|
+
**Developer Experience**: Work with familiar Rails patterns (layouts, pages, partials) without a full Rails application, allowing you to host it for free directly on Cloudflare CDNs and other static hosting services.
|
|
20
|
+
|
|
21
|
+
**Version Control & Mobile Editing**: Your entire site is code in a Git repository. Track changes, collaborate, and edit from anywhere - even your phone with tools like Cursor Agents. No database migrations or CMS interfaces needed. Lightning fast.
|
|
22
|
+
|
|
23
|
+
## Main Objective
|
|
24
|
+
|
|
25
|
+
Generate static HTML pages using ERB files. Simple and flexible - add your own JavaScript bundling and CSS processing as needed.
|
|
13
26
|
|
|
14
27
|
## Installation
|
|
15
28
|
|
|
@@ -37,10 +50,9 @@ bundle install
|
|
|
37
50
|
ruby bin/generate my-site
|
|
38
51
|
```
|
|
39
52
|
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
-
|
|
43
|
-
- npm packages for JS bundlers and frameworks
|
|
53
|
+
Generated sites use:
|
|
54
|
+
- ERB templates for HTML generation
|
|
55
|
+
- local build code in `lib/site_builder.rb` (no runtime dependency on this gem)
|
|
44
56
|
|
|
45
57
|
## What Gets Generated
|
|
46
58
|
|
|
@@ -48,231 +60,130 @@ A clean project structure that depends on gems:
|
|
|
48
60
|
|
|
49
61
|
```
|
|
50
62
|
my-site/
|
|
51
|
-
├── Gemfile # Dependencies (
|
|
52
|
-
├──
|
|
53
|
-
├── Rakefile # Build tasks (includes sitemap generation)
|
|
63
|
+
├── Gemfile # Dependencies (rake, webrick, sitemap_generator, etc.)
|
|
64
|
+
├── Rakefile # Build tasks (assets, HTML, CSS, sitemap, dev server)
|
|
54
65
|
├── config/
|
|
55
|
-
│ ├── importmap.rb # Importmap config (if using importmap)
|
|
56
66
|
│ └── sitemap.rb # Sitemap generation config
|
|
57
67
|
├── app/
|
|
58
68
|
│ ├── views/
|
|
59
69
|
│ │ ├── layouts/
|
|
60
70
|
│ │ ├── pages/
|
|
61
|
-
│ │ └── components/ # Reusable components/partials
|
|
62
71
|
│ ├── javascript/
|
|
63
72
|
│ └── assets/
|
|
73
|
+
│ └── stylesheets/
|
|
64
74
|
└── lib/
|
|
65
|
-
|
|
66
|
-
└── page_helpers.rb # Page metadata (title, description, etc.)
|
|
75
|
+
└── site_builder.rb # Compiles your site
|
|
67
76
|
```
|
|
68
77
|
|
|
69
78
|
## How It Works
|
|
70
79
|
|
|
71
|
-
1. **Generator** (`static-site-
|
|
72
|
-
2. **
|
|
73
|
-
3. **
|
|
74
|
-
4. **
|
|
80
|
+
1. **Generator** (`static-site-builder new ...`) - Creates the project structure
|
|
81
|
+
2. **Generated build code** (`lib/site_builder.rb`) - Compiles pages/layouts and provides WebSocket live reload
|
|
82
|
+
3. **Build tools** (`Rakefile`) - Defines `build:*` tasks and `dev:server`
|
|
83
|
+
4. **Your tools** - Add Tailwind, bundlers, etc, and wire them via `package.json` scripts
|
|
75
84
|
|
|
76
85
|
## Features
|
|
77
86
|
|
|
78
87
|
- 🎯 **Static HTML output** - No server-side rendering needed
|
|
79
|
-
- 🔧 **
|
|
80
|
-
- 📦 **
|
|
88
|
+
- 🔧 **Simple & flexible** - ERB files, add your own tools
|
|
89
|
+
- 📦 **Self-contained generated sites** - No runtime dependency on this gem
|
|
81
90
|
- 🚀 **Fast builds** - Compile once, deploy everywhere
|
|
82
|
-
-
|
|
83
|
-
- 📱 **Modern JS** - ES modules, importmaps, or bundlers
|
|
84
|
-
|
|
85
|
-
## Supported Stacks
|
|
86
|
-
|
|
87
|
-
### Template Engines
|
|
88
|
-
- **ERB** - Ruby's embedded Ruby templates
|
|
89
|
-
- **Phlex** - Ruby component library (via phlex-rails gem)
|
|
91
|
+
- 🔄 **Live reload** - Rebuild and refresh on changes in development
|
|
90
92
|
|
|
91
|
-
|
|
92
|
-
- **Importmap** - No bundling, use ES modules directly (via importmap-rails gem)
|
|
93
|
-
- **ESBuild** - Fast JavaScript bundler
|
|
94
|
-
- **Webpack** - Powerful bundler with plugins
|
|
95
|
-
- **Vite** - Next-generation frontend tooling
|
|
96
|
-
- **None** - Vanilla JavaScript, no bundling
|
|
97
|
-
|
|
98
|
-
### CSS Frameworks
|
|
99
|
-
- **TailwindCSS** - Utility-first CSS framework
|
|
100
|
-
- **shadcn/ui** - Re-usable components built with Tailwind
|
|
101
|
-
- **Plain CSS** - Write your own styles
|
|
102
|
-
|
|
103
|
-
### JavaScript Frameworks
|
|
104
|
-
- **Stimulus** - Modest JavaScript framework
|
|
105
|
-
- **React** - Popular UI library
|
|
106
|
-
- **Vue** - Progressive JavaScript framework
|
|
107
|
-
- **Alpine.js** - Minimal framework for HTML
|
|
108
|
-
- **Vanilla JS** - No framework
|
|
109
|
-
|
|
110
|
-
## Building Powerful Websites
|
|
111
|
-
|
|
112
|
-
### Using ERB Templates
|
|
113
|
-
|
|
114
|
-
Create pages in `app/views/pages/`:
|
|
115
|
-
|
|
116
|
-
```erb
|
|
117
|
-
<h1><%= @title %></h1>
|
|
118
|
-
<p><%= @description %></p>
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
Page metadata is automatically configured in `lib/page_helpers.rb` (generated automatically):
|
|
122
|
-
|
|
123
|
-
```ruby
|
|
124
|
-
module PageHelpers
|
|
125
|
-
PAGES = {
|
|
126
|
-
'/' => {
|
|
127
|
-
title: 'My Page',
|
|
128
|
-
description: 'A great page',
|
|
129
|
-
url: 'https://example.com',
|
|
130
|
-
image: 'https://example.com/image.jpg',
|
|
131
|
-
priority: 1.0,
|
|
132
|
-
changefreq: 'weekly'
|
|
133
|
-
}
|
|
134
|
-
}.freeze
|
|
135
|
-
end
|
|
136
|
-
```
|
|
93
|
+
## Templates
|
|
137
94
|
|
|
138
|
-
|
|
95
|
+
Generated sites use **ActionView** for Rails-like templates, helpers, layouts, and partials.
|
|
139
96
|
|
|
140
|
-
|
|
97
|
+
Create a layout in `app/views/layouts/application.html.erb`:
|
|
141
98
|
|
|
142
99
|
```erb
|
|
143
100
|
<!DOCTYPE html>
|
|
144
|
-
<html>
|
|
101
|
+
<html lang="en">
|
|
145
102
|
<head>
|
|
146
|
-
<
|
|
103
|
+
<meta charset="UTF-8">
|
|
104
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
105
|
+
<link rel="stylesheet" href="/assets/stylesheets/application.css">
|
|
147
106
|
</head>
|
|
148
107
|
<body>
|
|
149
|
-
|
|
108
|
+
<main>
|
|
109
|
+
<%= yield %>
|
|
110
|
+
</main>
|
|
111
|
+
|
|
112
|
+
<% if content_for?(:javascript) %>
|
|
113
|
+
<%= yield(:javascript) %>
|
|
114
|
+
<% end %>
|
|
150
115
|
</body>
|
|
151
116
|
</html>
|
|
152
117
|
```
|
|
153
118
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
Create reusable components in `app/views/components/`:
|
|
157
|
-
|
|
158
|
-
```ruby
|
|
159
|
-
class Button < Phlex::HTML
|
|
160
|
-
def initialize(text:, href:, variant: "primary")
|
|
161
|
-
@text = text
|
|
162
|
-
@href = href
|
|
163
|
-
@variant = variant
|
|
164
|
-
end
|
|
165
|
-
|
|
166
|
-
def template
|
|
167
|
-
a(href: @href, class: "btn btn-#{@variant}") { @text }
|
|
168
|
-
end
|
|
169
|
-
end
|
|
170
|
-
```
|
|
171
|
-
|
|
172
|
-
Use in pages:
|
|
119
|
+
`yield` outputs the page content. Use `content_for(:javascript)` to push scripts into the layout.
|
|
173
120
|
|
|
174
|
-
|
|
175
|
-
class HomePage < Phlex::HTML
|
|
176
|
-
def template
|
|
177
|
-
div do
|
|
178
|
-
h1 { "Welcome" }
|
|
179
|
-
render Button.new(text: "Get Started", href: "/about")
|
|
180
|
-
end
|
|
181
|
-
end
|
|
182
|
-
end
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
### JavaScript with Importmap
|
|
121
|
+
### Partials
|
|
186
122
|
|
|
187
|
-
|
|
123
|
+
Partials work like Rails, including `locals:`:
|
|
188
124
|
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
import { Application } from "@hotwired/stimulus"
|
|
192
|
-
import HelloController from "./controllers/hello_controller"
|
|
193
|
-
|
|
194
|
-
window.Stimulus = Application.start()
|
|
195
|
-
Stimulus.register("hello", HelloController)
|
|
125
|
+
```erb
|
|
126
|
+
<%= render partial: 'shared/header', locals: { title: 'Home' } %>
|
|
196
127
|
```
|
|
197
128
|
|
|
198
|
-
### JavaScript
|
|
199
|
-
|
|
200
|
-
Use ESBuild, Webpack, or Vite for modern tooling:
|
|
129
|
+
### Adding JavaScript
|
|
201
130
|
|
|
202
|
-
|
|
203
|
-
// app/javascript/index.js
|
|
204
|
-
import React from 'react'
|
|
205
|
-
import { createRoot } from 'react-dom/client'
|
|
131
|
+
Include JavaScript files in your pages:
|
|
206
132
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
const root = createRoot(document.getElementById('app'))
|
|
212
|
-
root.render(<App />)
|
|
133
|
+
```erb
|
|
134
|
+
<% content_for(:javascript) do %>
|
|
135
|
+
<script src="/assets/javascripts/application.js"></script>
|
|
136
|
+
<% end %>
|
|
213
137
|
```
|
|
214
138
|
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
Use utility classes directly in templates:
|
|
139
|
+
If you add a `package.json` with a `scripts.build`, `rake build:assets` will run `npm run build`. If you do not, it copies `app/javascript/` into `dist/assets/javascripts/`.
|
|
218
140
|
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
```
|
|
141
|
+
Set up your own bundler if needed and output to `dist/assets/javascripts/`. See setup guides:
|
|
142
|
+
- [ESBuild](guides/setup-esbuild.md)
|
|
143
|
+
- [Webpack](https://webpack.js.org/) - see webpack documentation
|
|
144
|
+
- [Vite](https://github.com/ElMassimo/vite_ruby) - see vite-plugin-ruby
|
|
224
145
|
|
|
225
|
-
### CSS
|
|
146
|
+
### Adding CSS
|
|
226
147
|
|
|
227
|
-
|
|
148
|
+
Write CSS in `app/assets/stylesheets/application.css`. Use any CSS tool you prefer:
|
|
228
149
|
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
```
|
|
150
|
+
- [Tailwind CSS](guides/setup-tailwind.md)
|
|
151
|
+
- PostCSS, Sass, Less, or any other CSS processor - just compile your CSS files to `dist/assets/stylesheets/` before building HTML.
|
|
232
152
|
|
|
233
153
|
### Generating Sitemaps
|
|
234
154
|
|
|
235
155
|
Sitemap generation is automatically configured when you generate a new site. The `sitemap_generator` gem is included in the Gemfile, and `config/sitemap.rb` is automatically created.
|
|
236
156
|
|
|
237
|
-
The sitemap is generated from
|
|
157
|
+
The sitemap is automatically generated from all pages in `app/views/pages/` during `rake build:all`. Update `config/sitemap.rb` to set your domain:
|
|
238
158
|
|
|
239
159
|
```ruby
|
|
240
160
|
SitemapGenerator::Sitemap.default_host = 'https://yourdomain.com'
|
|
241
161
|
```
|
|
242
162
|
|
|
243
|
-
The sitemap will be generated in `dist/sitemaps/sitemap.xml.gz` during the build process.
|
|
163
|
+
You can customize priority, changefreq, and lastmod in `config/sitemap.rb`. The sitemap will be generated in `dist/sitemaps/sitemap.xml.gz` during the build process.
|
|
244
164
|
|
|
245
165
|
## Examples
|
|
246
166
|
|
|
247
|
-
### ERB
|
|
167
|
+
### Basic ERB Site
|
|
248
168
|
```bash
|
|
249
169
|
static-site-builder new my-site
|
|
250
|
-
# Choose: ERB, Importmap, TailwindCSS, Stimulus
|
|
251
170
|
```
|
|
252
171
|
|
|
253
|
-
|
|
254
|
-
```bash
|
|
255
|
-
static-site-builder new my-site
|
|
256
|
-
# Choose: Phlex, ESBuild, shadcn/ui, React
|
|
257
|
-
```
|
|
172
|
+
## Notable Projects
|
|
258
173
|
|
|
259
|
-
|
|
174
|
+
Sites built with Static Site Builder:
|
|
260
175
|
|
|
261
|
-
|
|
176
|
+
- **[lukaszczapiewski.com](https://lukaszczapiewski.com)** - Personal portfolio and blog
|
|
262
177
|
|
|
263
|
-
|
|
178
|
+
**Your website?** Built with Static Site Builder? [Submit a PR](https://github.com/Ancez/static-site-builder) to add it here!
|
|
264
179
|
|
|
265
|
-
|
|
266
|
-
```bash
|
|
267
|
-
npm install
|
|
268
|
-
```
|
|
180
|
+
## Requirements
|
|
269
181
|
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
rake build:all
|
|
273
|
-
```
|
|
182
|
+
- Ruby 3.0+
|
|
183
|
+
- Bundler
|
|
274
184
|
|
|
275
|
-
|
|
185
|
+
Optional (if you want to use Tailwind CSS or JavaScript bundlers):
|
|
186
|
+
- Node.js and npm
|
|
276
187
|
|
|
277
188
|
## Development
|
|
278
189
|
|
|
@@ -283,7 +194,6 @@ After generating a site, you can run it locally with auto-rebuild and live reloa
|
|
|
283
194
|
```bash
|
|
284
195
|
cd my-site
|
|
285
196
|
bundle install
|
|
286
|
-
npm install # Required for importmap projects and JS frameworks
|
|
287
197
|
|
|
288
198
|
# Start development server (auto-rebuilds on file changes)
|
|
289
199
|
rake dev:server
|
|
@@ -316,142 +226,12 @@ rake build:html
|
|
|
316
226
|
|
|
317
227
|
The `dist/` directory contains your complete static site and can be deployed to any static hosting provider.
|
|
318
228
|
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
- **Build output directory**: `dist`
|
|
326
|
-
- **Root directory**: (leave empty or set to repository root)
|
|
327
|
-
|
|
328
|
-
3. **Environment variables** (if needed):
|
|
329
|
-
- `RUBY_VERSION`: Set to your Ruby version (e.g., `3.4`)
|
|
330
|
-
- `NODE_VERSION`: Set to your Node.js version (e.g., `24`)
|
|
331
|
-
|
|
332
|
-
4. **Deploy**: Cloudflare Pages will automatically build and deploy on every push to your main branch
|
|
333
|
-
|
|
334
|
-
**Note**: Cloudflare Pages supports Ruby and Node.js builds. Ensure your `Gemfile` and `package.json` are properly configured.
|
|
335
|
-
|
|
336
|
-
### Vercel
|
|
337
|
-
|
|
338
|
-
1. **Install Vercel CLI** (optional):
|
|
339
|
-
```bash
|
|
340
|
-
npm i -g vercel
|
|
341
|
-
```
|
|
342
|
-
|
|
343
|
-
2. **Deploy**:
|
|
344
|
-
```bash
|
|
345
|
-
# Build locally first
|
|
346
|
-
bundle install && npm install && bundle exec rake build:all
|
|
347
|
-
|
|
348
|
-
# Deploy
|
|
349
|
-
vercel --prod
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
Or connect your repository in the Vercel dashboard with these settings:
|
|
353
|
-
- **Build Command**: `bundle install && npm install && bundle exec rake build:all`
|
|
354
|
-
- **Output Directory**: `dist`
|
|
355
|
-
- **Install Command**: `bundle install && npm install`
|
|
356
|
-
|
|
357
|
-
3. **Configuration file** (optional `vercel.json`):
|
|
358
|
-
```json
|
|
359
|
-
{
|
|
360
|
-
"buildCommand": "bundle install && npm install && bundle exec rake build:all",
|
|
361
|
-
"outputDirectory": "dist",
|
|
362
|
-
"installCommand": "bundle install && npm install"
|
|
363
|
-
}
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
### Netlify
|
|
367
|
-
|
|
368
|
-
1. **Create `netlify.toml`** in your project root:
|
|
369
|
-
```toml
|
|
370
|
-
[build]
|
|
371
|
-
command = "bundle install && npm install && bundle exec rake build:all"
|
|
372
|
-
publish = "dist"
|
|
373
|
-
|
|
374
|
-
[build.environment]
|
|
375
|
-
RUBY_VERSION = "3.4"
|
|
376
|
-
NODE_VERSION = "24"
|
|
377
|
-
```
|
|
378
|
-
|
|
379
|
-
2. **Deploy**:
|
|
380
|
-
- Connect your repository in Netlify dashboard
|
|
381
|
-
- Netlify will automatically detect `netlify.toml` and use those settings
|
|
382
|
-
- Or use Netlify CLI: `netlify deploy --prod`
|
|
383
|
-
|
|
384
|
-
### GitHub Pages
|
|
385
|
-
|
|
386
|
-
1. **Using GitHub Actions** (recommended):
|
|
387
|
-
|
|
388
|
-
Create `.github/workflows/deploy.yml`:
|
|
389
|
-
```yaml
|
|
390
|
-
name: Deploy to GitHub Pages
|
|
391
|
-
|
|
392
|
-
on:
|
|
393
|
-
push:
|
|
394
|
-
branches: [ main ]
|
|
395
|
-
|
|
396
|
-
jobs:
|
|
397
|
-
deploy:
|
|
398
|
-
runs-on: ubuntu-latest
|
|
399
|
-
steps:
|
|
400
|
-
- uses: actions/checkout@v4
|
|
401
|
-
|
|
402
|
-
- name: Set up Ruby
|
|
403
|
-
uses: ruby/setup-ruby@v1
|
|
404
|
-
with:
|
|
405
|
-
ruby-version: 3.4
|
|
406
|
-
bundler-cache: true
|
|
407
|
-
|
|
408
|
-
- name: Set up Node.js
|
|
409
|
-
uses: actions/setup-node@v4
|
|
410
|
-
with:
|
|
411
|
-
node-version: '24'
|
|
412
|
-
cache: 'npm'
|
|
413
|
-
|
|
414
|
-
- name: Install dependencies
|
|
415
|
-
run: |
|
|
416
|
-
bundle install
|
|
417
|
-
npm install
|
|
418
|
-
|
|
419
|
-
- name: Build site
|
|
420
|
-
run: bundle exec rake build:all
|
|
421
|
-
# Note: Vendor files will be automatically copied from node_modules during build
|
|
422
|
-
|
|
423
|
-
- name: Deploy to GitHub Pages
|
|
424
|
-
uses: peaceiris/actions-gh-pages@v4
|
|
425
|
-
with:
|
|
426
|
-
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
427
|
-
publish_dir: ./dist
|
|
428
|
-
```
|
|
429
|
-
|
|
430
|
-
2. **Enable GitHub Pages** in your repository settings:
|
|
431
|
-
- Go to Settings → Pages
|
|
432
|
-
- Source: GitHub Actions
|
|
433
|
-
|
|
434
|
-
### Other Static Hosts
|
|
435
|
-
|
|
436
|
-
For any static hosting provider (AWS S3, Azure Static Web Apps, etc.):
|
|
437
|
-
|
|
438
|
-
1. **Build locally**:
|
|
439
|
-
```bash
|
|
440
|
-
bundle install
|
|
441
|
-
npm install
|
|
442
|
-
bundle exec rake build:all
|
|
443
|
-
```
|
|
444
|
-
|
|
445
|
-
2. **Upload `dist/` directory** to your hosting provider
|
|
446
|
-
|
|
447
|
-
3. **Configure** your host to serve from the `dist` directory
|
|
448
|
-
|
|
449
|
-
### CI/CD Considerations
|
|
450
|
-
|
|
451
|
-
- **Vendor files**: Vendor files are automatically copied from `node_modules` to `dist/` during build - no vendor folder needed
|
|
452
|
-
- **Dependencies**: Both Ruby (`Gemfile`) and Node.js (`package.json`) dependencies are needed for the build
|
|
453
|
-
- **Build order**: Install dependencies → Build assets → Build HTML
|
|
454
|
-
- **Ruby/Node versions**: Specify versions in your CI/CD configuration to ensure consistent builds
|
|
229
|
+
See deployment guides for specific platforms:
|
|
230
|
+
- [Cloudflare Pages](guides/deployment-cloudflare.md)
|
|
231
|
+
- [Vercel](guides/deployment-vercel.md)
|
|
232
|
+
- [Netlify](guides/deployment-netlify.md)
|
|
233
|
+
- [GitHub Pages](guides/deployment-github-pages.md)
|
|
234
|
+
- [Other Static Hosts](guides/deployment-other.md)
|
|
455
235
|
|
|
456
236
|
### Generator Development
|
|
457
237
|
|
|
@@ -500,10 +280,8 @@ This generator follows the Rails pattern:
|
|
|
500
280
|
## Contributing
|
|
501
281
|
|
|
502
282
|
Contributions welcome! Especially:
|
|
503
|
-
- New template engine support
|
|
504
|
-
- New bundler integrations
|
|
505
|
-
- New CSS framework setups
|
|
506
283
|
- Documentation improvements
|
|
284
|
+
- New features and improvements
|
|
507
285
|
|
|
508
286
|
## License
|
|
509
287
|
|