static-site-builder 0.1.3 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: cfa2d9ecc9c90e973fd3cecd6c04e2aad09a80fa29ba0bd78a95b524206986c4
4
- data.tar.gz: 2394ef787382dec487390d4b05a1add37a27e3e9154f032f82d9972fae25924e
3
+ metadata.gz: b04601a6add58d7ee3a23a48d6456f16fd6fb09a486d1834604803b21cd2ca75
4
+ data.tar.gz: 717cfe27a34a388acea7a1f91a37b655040dc7ca1b97d4d6fe86c01c59d10f17
5
5
  SHA512:
6
- metadata.gz: 89d7320b08a5e90d12f7c155a8f2e2b0a7f907b9ff18c53c81632dcc5f49cd90e34d41b1533baf760bd4866a07aa06ad95a6f84ac4d34600ed8a86296a24b25e
7
- data.tar.gz: 7db49008d74e0aa849e084edb8a8ccc515c1764c3d97e3fb820e952697d3187dd3723e4f4edb4dc284b1dff5ccf5549de7de282413c4616d619d7a8addb693da
6
+ metadata.gz: 28c976044449130ad0da918875dfdfdbc32b09126f46f4ed2516b3d72fd0107ed8f63a6891c09414f37d13acee61f1c573ed1e40ad6c81f87a49628013037fdf
7
+ data.tar.gz: 6ae711f3f6fb8de54c2b2ec4f9b8c3bfbd2d4b6d8848ff078f95e3c0174523e0e9542779d1b331b0541c6c8fdcca6241bfd35b16d1d31cbfae29568d262592a4
data/CHANGELOG.md CHANGED
@@ -1,75 +1,29 @@
1
1
  # Changelog
2
2
 
3
- All notable changes to this project will be documented in this file.
3
+ ## 1.0.0 (Current) - 2025-12-13
4
4
 
5
- The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
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
- ## [0.1.3] - 2025-11-22
7
+ ### Features
9
8
 
10
- ### Added
11
- - Integrated ActionView 8+ for proper Rails-style partial rendering
12
- - Support for Rails-style render syntax: `render 'shared/header'` and `render partial: 'shared/header'`
13
- - Support for passing locals to partials: `render partial: 'shared/header', locals: { title: 'Hello' }`
14
- - Nested partial support (partials can render other partials)
15
- - Multiple partials on the same page now work correctly
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
- ### Changed
18
- - Replaced raw ERB implementation with ActionView::Base for template rendering
19
- - Render method now uses ActionView's rendering system, matching Rails behaviour exactly
20
- - Partials automatically receive page variables (frontmatter, js_modules, importmap_json, current_page)
21
- - Improved error messages for missing partials (converted from ActionView format for backwards compatibility)
22
- - Template annotations now preserve both page and layout annotations correctly
14
+ ### What Gets Generated
23
15
 
24
- ### Fixed
25
- - Fixed issue where nested partials (partials rendering other partials) would fail or produce incorrect output
26
- - Fixed issue where multiple partials on the same page would only render the last one
27
- - Fixed template annotations being stripped when layout annotations were added
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
- ## [0.1.2] - 2025-11-22
24
+ ### Requirements
30
25
 
31
- ### Fixed
32
- - CSS directory is now always created when Tailwind handles CSS compilation, preventing 404 errors for stylesheets
33
- - Build process now updates files in place instead of cleaning and recreating the dist directory, preventing 404 errors during rebuilds in development mode
34
- - Fixed race condition where pages would return 404 when code changes triggered rebuilds
26
+ - Ruby 3.0+
27
+ - Bundler
35
28
 
36
- ## [0.1.1] - 2025-11-21
37
-
38
- ### Added
39
- - `render` helper method for ERB templates to include partials
40
- - Support for rendering partials from `app/views/shared/` directory
41
- - Partial files should be named with `_` prefix (e.g., `_header.html.erb`)
42
- - Partials have access to page variables (frontmatter, js_modules, etc.)
43
-
44
- ### Changed
45
- - Improved ERB compilation to support partial rendering
46
-
47
- ## [0.0.1] - 2025-11-21
48
-
49
- ### Added
50
- - Initial release of static-site-builder gem
51
- - Generator for creating new static site projects
52
- - Builder for compiling ERB templates to static HTML
53
- - Support for multiple template engines (ERB, Phlex)
54
- - Support for multiple JavaScript bundlers (Importmap, ESBuild, Webpack, Vite, None)
55
- - Support for multiple CSS frameworks (TailwindCSS, shadcn/ui, Plain CSS)
56
- - Support for multiple JavaScript frameworks (Stimulus, React, Vue, Alpine.js, Vanilla)
57
- - Frontmatter parsing for ERB pages
58
- - Layout support with nested layouts
59
- - Importmap JSON generation
60
- - Asset copying (JavaScript, CSS, vendor files, static files)
61
- - Comprehensive test suite
62
- - YARD documentation
63
- - CI/CD setup (GitHub Actions)
64
-
65
- ### Changed
66
- - Vendor JavaScript files are automatically copied directly from `node_modules` to `dist/assets/javascripts/` during build
67
- - Removed requirement for `vendor/javascript/` folder - vendor files are copied automatically based on importmap configuration
68
- - Generator no longer creates vendor files during project generation
69
-
70
- ### Fixed
71
- - Added warning messages when vendor files cannot be found in `node_modules`
72
- - Updated base64 dependency comments to clarify requirement for Ruby 3.4+
73
-
74
- [0.0.1]: https://github.com/Ancez/static-site-builder/releases/tag/v0.0.1
75
29
 
data/README.md CHANGED
@@ -1,15 +1,28 @@
1
1
  # Static Site Builder
2
2
 
3
- A Ruby-based generator and builder for creating static HTML sites with working JavaScript. **No backend required** - just compile your templates to static HTML and deploy anywhere.
3
+ > **⚠️ Active Development**: This project is currently in active development.
4
4
 
5
- ## Main Objective
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
- Generate static HTML pages with JavaScript files that work. Choose your own stack:
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
- - **Template Engine**: ERB or Phlex
10
- - **JavaScript Bundler**: Importmap, ESBuild, Webpack, Vite, or none
11
- - **CSS Framework**: TailwindCSS, shadcn/ui, or plain CSS
12
- - **JavaScript Framework**: Stimulus, React, Vue, Alpine.js, or vanilla JS
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
- You'll be prompted to choose your stack using an interactive menu with arrow key navigation. Generated sites use:
41
- - `static-site-builder` gem for compilation
42
- - Standard gems (importmap-rails, phlex-rails, etc.) for functionality
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,203 +60,130 @@ A clean project structure that depends on gems:
48
60
 
49
61
  ```
50
62
  my-site/
51
- ├── Gemfile # Dependencies (static-site-builder, importmap-rails, etc.)
52
- ├── package.json # JS dependencies (if needed)
53
- ├── Rakefile # Build tasks
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)
66
+ │ └── sitemap.rb # Sitemap generation config
56
67
  ├── app/
57
68
  │ ├── views/
58
69
  │ │ ├── layouts/
59
70
  │ │ ├── pages/
60
- │ │ └── components/ # Reusable components/partials
61
71
  │ ├── javascript/
62
72
  │ └── assets/
73
+ │ └── stylesheets/
63
74
  └── lib/
64
75
  └── site_builder.rb # Compiles your site
65
76
  ```
66
77
 
67
78
  ## How It Works
68
79
 
69
- 1. **Generator** (`static-site-generator`) - Creates the project structure
70
- 2. **Builder Gem** (`static-site-builder`) - Handles ERB/Phlex compilation
71
- 3. **Standard Gems** - importmap-rails, phlex-rails, etc. for functionality
72
- 4. **Build Tools** - Rake tasks that use the builder gem
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
73
84
 
74
85
  ## Features
75
86
 
76
87
  - 🎯 **Static HTML output** - No server-side rendering needed
77
- - 🔧 **Flexible stack** - Choose what works for you
78
- - 📦 **Gem-based** - Uses existing Ruby gems, not custom code
88
+ - 🔧 **Simple & flexible** - ERB files, add your own tools
89
+ - 📦 **Self-contained generated sites** - No runtime dependency on this gem
79
90
  - 🚀 **Fast builds** - Compile once, deploy everywhere
80
- - 🎨 **Component support** - ERB or Phlex components
81
- - 📱 **Modern JS** - ES modules, importmaps, or bundlers
82
-
83
- ## Supported Stacks
91
+ - 🔄 **Live reload** - Rebuild and refresh on changes in development
84
92
 
85
- ### Template Engines
86
- - **ERB** - Ruby's embedded Ruby templates
87
- - **Phlex** - Ruby component library (via phlex-rails gem)
93
+ ## Templates
88
94
 
89
- ### JavaScript Bundlers
90
- - **Importmap** - No bundling, use ES modules directly (via importmap-rails gem)
91
- - **ESBuild** - Fast JavaScript bundler
92
- - **Webpack** - Powerful bundler with plugins
93
- - **Vite** - Next-generation frontend tooling
94
- - **None** - Vanilla JavaScript, no bundling
95
+ Generated sites use **ActionView** for Rails-like templates, helpers, layouts, and partials.
95
96
 
96
- ### CSS Frameworks
97
- - **TailwindCSS** - Utility-first CSS framework
98
- - **shadcn/ui** - Re-usable components built with Tailwind
99
- - **Plain CSS** - Write your own styles
100
-
101
- ### JavaScript Frameworks
102
- - **Stimulus** - Modest JavaScript framework
103
- - **React** - Popular UI library
104
- - **Vue** - Progressive JavaScript framework
105
- - **Alpine.js** - Minimal framework for HTML
106
- - **Vanilla JS** - No framework
107
-
108
- ## Building Powerful Websites
109
-
110
- ### Using ERB Templates
111
-
112
- Create pages in `app/views/pages/` with frontmatter:
113
-
114
- ```erb
115
- ---
116
- title: My Page
117
- description: A great page
118
- ---
119
-
120
- <h1><%= @title %></h1>
121
- <p><%= @description %></p>
122
- ```
123
-
124
- Use layouts in `app/views/layouts/application.html.erb`:
97
+ Create a layout in `app/views/layouts/application.html.erb`:
125
98
 
126
99
  ```erb
127
100
  <!DOCTYPE html>
128
- <html>
101
+ <html lang="en">
129
102
  <head>
130
- <title><%= @title || "My Site" %></title>
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">
131
106
  </head>
132
107
  <body>
133
- <%= yield %>
108
+ <main>
109
+ <%= yield %>
110
+ </main>
111
+
112
+ <% if content_for?(:javascript) %>
113
+ <%= yield(:javascript) %>
114
+ <% end %>
134
115
  </body>
135
116
  </html>
136
117
  ```
137
118
 
138
- ### Using Phlex Components
119
+ `yield` outputs the page content. Use `content_for(:javascript)` to push scripts into the layout.
139
120
 
140
- Create reusable components in `app/views/components/`:
121
+ ### Partials
141
122
 
142
- ```ruby
143
- class Button < Phlex::HTML
144
- def initialize(text:, href:, variant: "primary")
145
- @text = text
146
- @href = href
147
- @variant = variant
148
- end
149
-
150
- def template
151
- a(href: @href, class: "btn btn-#{@variant}") { @text }
152
- end
153
- end
154
- ```
155
-
156
- Use in pages:
123
+ Partials work like Rails, including `locals:`:
157
124
 
158
- ```ruby
159
- class HomePage < Phlex::HTML
160
- def template
161
- div do
162
- h1 { "Welcome" }
163
- render Button.new(text: "Get Started", href: "/about")
164
- end
165
- end
166
- end
125
+ ```erb
126
+ <%= render partial: 'shared/header', locals: { title: 'Home' } %>
167
127
  ```
168
128
 
169
- ### JavaScript with Importmap
129
+ ### Adding JavaScript
170
130
 
171
- No bundling needed - use ES modules directly:
131
+ Include JavaScript files in your pages:
172
132
 
173
- ```javascript
174
- // app/javascript/application.js
175
- import { Application } from "@hotwired/stimulus"
176
- import HelloController from "./controllers/hello_controller"
177
-
178
- window.Stimulus = Application.start()
179
- Stimulus.register("hello", HelloController)
133
+ ```erb
134
+ <% content_for(:javascript) do %>
135
+ <script src="/assets/javascripts/application.js"></script>
136
+ <% end %>
180
137
  ```
181
138
 
182
- ### JavaScript with Bundlers
183
-
184
- Use ESBuild, Webpack, or Vite for modern tooling:
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/`.
185
140
 
186
- ```javascript
187
- // app/javascript/index.js
188
- import React from 'react'
189
- import { createRoot } from 'react-dom/client'
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
190
145
 
191
- function App() {
192
- return <h1>Hello from React!</h1>
193
- }
194
-
195
- const root = createRoot(document.getElementById('app'))
196
- root.render(<App />)
197
- ```
146
+ ### Adding CSS
198
147
 
199
- ### CSS with TailwindCSS
148
+ Write CSS in `app/assets/stylesheets/application.css`. Use any CSS tool you prefer:
200
149
 
201
- Use utility classes directly in templates:
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.
202
152
 
203
- ```erb
204
- <div class="container mx-auto px-4">
205
- <h1 class="text-4xl font-bold text-gray-900">Hello World</h1>
206
- </div>
207
- ```
153
+ ### Generating Sitemaps
208
154
 
209
- ### CSS with shadcn/ui
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.
210
156
 
211
- Install components and use them in your templates:
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:
212
158
 
213
- ```bash
214
- npx shadcn-ui@latest add button
159
+ ```ruby
160
+ SitemapGenerator::Sitemap.default_host = 'https://yourdomain.com'
215
161
  ```
216
162
 
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.
164
+
217
165
  ## Examples
218
166
 
219
- ### ERB + Importmap + Stimulus + TailwindCSS
167
+ ### Basic ERB Site
220
168
  ```bash
221
169
  static-site-builder new my-site
222
- # Choose: ERB, Importmap, TailwindCSS, Stimulus
223
170
  ```
224
171
 
225
- ### Phlex + ESBuild + React + shadcn
226
- ```bash
227
- static-site-builder new my-site
228
- # Choose: Phlex, ESBuild, shadcn/ui, React
229
- ```
172
+ ## Notable Projects
230
173
 
231
- ## Requirements
174
+ Sites built with Static Site Builder:
232
175
 
233
- ### For Importmap Projects
176
+ - **[lukaszczapiewski.com](https://lukaszczapiewski.com)** - Personal portfolio and blog
234
177
 
235
- When using **Importmap** as your JavaScript bundler:
178
+ **Your website?** Built with Static Site Builder? [Submit a PR](https://github.com/Ancez/static-site-builder) to add it here!
236
179
 
237
- 1. **Install npm dependencies**:
238
- ```bash
239
- npm install
240
- ```
180
+ ## Requirements
241
181
 
242
- 2. **Build your site** - vendor files are automatically copied from `node_modules` to `dist/assets/javascripts/` during the build:
243
- ```bash
244
- rake build:all
245
- ```
182
+ - Ruby 3.0+
183
+ - Bundler
246
184
 
247
- The build process automatically copies required vendor JavaScript files directly from `node_modules` to `dist/assets/javascripts/` based on your importmap configuration. No intermediate `vendor/javascript/` folder is needed.
185
+ Optional (if you want to use Tailwind CSS or JavaScript bundlers):
186
+ - Node.js and npm
248
187
 
249
188
  ## Development
250
189
 
@@ -255,7 +194,6 @@ After generating a site, you can run it locally with auto-rebuild and live reloa
255
194
  ```bash
256
195
  cd my-site
257
196
  bundle install
258
- npm install # Required for importmap projects and JS frameworks
259
197
 
260
198
  # Start development server (auto-rebuilds on file changes)
261
199
  rake dev:server
@@ -288,142 +226,12 @@ rake build:html
288
226
 
289
227
  The `dist/` directory contains your complete static site and can be deployed to any static hosting provider.
290
228
 
291
- ### Cloudflare Pages
292
-
293
- 1. **Connect your repository** to Cloudflare Pages in the Cloudflare dashboard
294
-
295
- 2. **Build settings**:
296
- - **Build command**: `bundle install && npm install && bundle exec rake build:all`
297
- - **Build output directory**: `dist`
298
- - **Root directory**: (leave empty or set to repository root)
299
-
300
- 3. **Environment variables** (if needed):
301
- - `RUBY_VERSION`: Set to your Ruby version (e.g., `3.4`)
302
- - `NODE_VERSION`: Set to your Node.js version (e.g., `24`)
303
-
304
- 4. **Deploy**: Cloudflare Pages will automatically build and deploy on every push to your main branch
305
-
306
- **Note**: Cloudflare Pages supports Ruby and Node.js builds. Ensure your `Gemfile` and `package.json` are properly configured.
307
-
308
- ### Vercel
309
-
310
- 1. **Install Vercel CLI** (optional):
311
- ```bash
312
- npm i -g vercel
313
- ```
314
-
315
- 2. **Deploy**:
316
- ```bash
317
- # Build locally first
318
- bundle install && npm install && bundle exec rake build:all
319
-
320
- # Deploy
321
- vercel --prod
322
- ```
323
-
324
- Or connect your repository in the Vercel dashboard with these settings:
325
- - **Build Command**: `bundle install && npm install && bundle exec rake build:all`
326
- - **Output Directory**: `dist`
327
- - **Install Command**: `bundle install && npm install`
328
-
329
- 3. **Configuration file** (optional `vercel.json`):
330
- ```json
331
- {
332
- "buildCommand": "bundle install && npm install && bundle exec rake build:all",
333
- "outputDirectory": "dist",
334
- "installCommand": "bundle install && npm install"
335
- }
336
- ```
337
-
338
- ### Netlify
339
-
340
- 1. **Create `netlify.toml`** in your project root:
341
- ```toml
342
- [build]
343
- command = "bundle install && npm install && bundle exec rake build:all"
344
- publish = "dist"
345
-
346
- [build.environment]
347
- RUBY_VERSION = "3.4"
348
- NODE_VERSION = "24"
349
- ```
350
-
351
- 2. **Deploy**:
352
- - Connect your repository in Netlify dashboard
353
- - Netlify will automatically detect `netlify.toml` and use those settings
354
- - Or use Netlify CLI: `netlify deploy --prod`
355
-
356
- ### GitHub Pages
357
-
358
- 1. **Using GitHub Actions** (recommended):
359
-
360
- Create `.github/workflows/deploy.yml`:
361
- ```yaml
362
- name: Deploy to GitHub Pages
363
-
364
- on:
365
- push:
366
- branches: [ main ]
367
-
368
- jobs:
369
- deploy:
370
- runs-on: ubuntu-latest
371
- steps:
372
- - uses: actions/checkout@v4
373
-
374
- - name: Set up Ruby
375
- uses: ruby/setup-ruby@v1
376
- with:
377
- ruby-version: 3.4
378
- bundler-cache: true
379
-
380
- - name: Set up Node.js
381
- uses: actions/setup-node@v4
382
- with:
383
- node-version: '24'
384
- cache: 'npm'
385
-
386
- - name: Install dependencies
387
- run: |
388
- bundle install
389
- npm install
390
-
391
- - name: Build site
392
- run: bundle exec rake build:all
393
- # Note: Vendor files will be automatically copied from node_modules during build
394
-
395
- - name: Deploy to GitHub Pages
396
- uses: peaceiris/actions-gh-pages@v4
397
- with:
398
- github_token: ${{ secrets.GITHUB_TOKEN }}
399
- publish_dir: ./dist
400
- ```
401
-
402
- 2. **Enable GitHub Pages** in your repository settings:
403
- - Go to Settings → Pages
404
- - Source: GitHub Actions
405
-
406
- ### Other Static Hosts
407
-
408
- For any static hosting provider (AWS S3, Azure Static Web Apps, etc.):
409
-
410
- 1. **Build locally**:
411
- ```bash
412
- bundle install
413
- npm install
414
- bundle exec rake build:all
415
- ```
416
-
417
- 2. **Upload `dist/` directory** to your hosting provider
418
-
419
- 3. **Configure** your host to serve from the `dist` directory
420
-
421
- ### CI/CD Considerations
422
-
423
- - **Vendor files**: Vendor files are automatically copied from `node_modules` to `dist/` during build - no vendor folder needed
424
- - **Dependencies**: Both Ruby (`Gemfile`) and Node.js (`package.json`) dependencies are needed for the build
425
- - **Build order**: Install dependencies → Build assets → Build HTML
426
- - **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)
427
235
 
428
236
  ### Generator Development
429
237
 
@@ -472,10 +280,8 @@ This generator follows the Rails pattern:
472
280
  ## Contributing
473
281
 
474
282
  Contributions welcome! Especially:
475
- - New template engine support
476
- - New bundler integrations
477
- - New CSS framework setups
478
283
  - Documentation improvements
284
+ - New features and improvements
479
285
 
480
286
  ## License
481
287
 
data/bin/generate CHANGED
@@ -2,7 +2,6 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  require_relative "../lib/static_site_builder"
5
- require "tty-prompt"
6
5
 
7
6
  def main
8
7
  if ARGV.empty?
@@ -14,50 +13,14 @@ def main
14
13
  app_name = ARGV[0]
15
14
 
16
15
  if Dir.exist?(app_name)
17
- puts "Error: Directory '#{app_name}' already exists"
16
+ puts "Error: Directory '#{app_name}' already exists. Please choose a different name."
18
17
  exit 1
19
18
  end
20
19
 
21
- puts "Generating static site: #{app_name}"
22
- puts "=" * 50
23
-
24
- prompt = TTY::Prompt.new
25
-
26
- template_engine = prompt.select(
27
- "Template engine?",
28
- StaticSiteBuilder::Generator::TEMPLATE_ENGINES.map(&:capitalize),
29
- default: 1
30
- ).downcase
31
-
32
- js_bundler = prompt.select(
33
- "JavaScript bundler?",
34
- StaticSiteBuilder::Generator::JS_BUNDLERS.map(&:capitalize),
35
- default: 1
36
- ).downcase
37
-
38
- css_framework = prompt.select(
39
- "CSS framework?",
40
- StaticSiteBuilder::Generator::CSS_FRAMEWORKS.map(&:capitalize),
41
- default: 1
42
- ).downcase
43
-
44
- js_framework = prompt.select(
45
- "JavaScript framework?",
46
- StaticSiteBuilder::Generator::JS_FRAMEWORKS.map(&:capitalize),
47
- default: 1
48
- ).downcase
49
-
50
- options = {
51
- template_engine: template_engine,
52
- js_bundler: js_bundler,
53
- css_framework: css_framework,
54
- js_framework: js_framework
55
- }
56
-
57
- generator = StaticSiteBuilder::Generator.new(app_name, options)
20
+ generator = StaticSiteBuilder::Generator.new(app_name)
58
21
  generator.generate
59
22
  rescue Interrupt
60
- puts "\n\nGeneration cancelled."
23
+ puts "\n\nGeneration cancelled by user."
61
24
  exit 1
62
25
  end
63
26