Class: Wytch::Builder
- Inherits:
-
Object
- Object
- Wytch::Builder
- Defined in:
- lib/wytch/builder.rb
Overview
Builds the static site.
Constant Summary collapse
- OUTPUT_DIR =
"build"
Instance Method Summary collapse
-
#build ⇒ void
Builds the entire site.
Instance Method Details
#build ⇒ void
This method returns an undefined value.
Builds the entire site.
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/wytch/builder.rb', line 16 def build ENV["RACK_ENV"] = "production" Site.load! Wytch.site.site_code_loader.eager_load Wytch.site.load_content FileUtils.mkdir(OUTPUT_DIR) unless Dir.exist?(OUTPUT_DIR) Wytch.site.pages.values.each do |page| build_path = File.join(OUTPUT_DIR, page.build_path) puts "Building #{page.path} → #{build_path}" FileUtils.mkdir_p File.dirname(build_path) File.write build_path, page.render end copy_public_files copy_vite_assets end |