Static Rails

screenshot of Static Rails

Build & serve static sites (e.g. Jekyll, Hugo) from your Rails app

Overview:

The article introduces a gem called static-rails which allows users to build and serve static sites from their Rails app. It addresses the challenge of incorporating static assets with Rails architecture, providing a solution that enables seamless transition between static sites and Rails app. The gem offers features such as local server launch and request proxying in development, automatic asset compilation during deployment, and serving compiled assets in production.

Features:

  • Development Server and Request Proxying: Launches local servers for static sites and proxies requests to the mounted locations in the Rails app.
  • Automatic Asset Compilation: Compiles static assets when the rake assets:precompile command is run during deployment.
  • Serving Compiled Assets: Serves compiled assets from disk in production, similar to hosting files from the public/ directory.

Summary:

The static-rails gem allows users to incorporate static site generators with their Rails app without deviating from the monolithic architecture. It provides development server launch and request proxying, automatic asset compilation during deployment, and serving compiled assets from disk in production. The installation process involves adding the gem to the Gemfile and generating a configuration file. Overall, static-rails simplifies the integration of static assets with Rails and enhances the development experience.