Gakubuchi provides a simple way to manage static pages (e.g. error pages) with Asset Pipeline.
Put this in your Gemfile:
Run the installation generator with:
rails g gakubuchi:install
Or specify the name of directory for static pages:
rails g gakubuchi:install -d html
They will install the initializer into
config/initializers/gakubuchi.rb and create the directory in
If you don't specify the
templates will be used as default.
doctype html html head title The page you were looking for doesn't exist (404) meta name='viewport' content='width=device-width,initial-scale=1' = stylesheet_link_tag 'application', media: 'all' body .dialog div h1 The page you were looking for doesn't exist. p You may have mistyped the address or the page may have moved. p If you are the application owner check the logs for more information.
Open the following URL in your browser to check the templeate:
Compile the templeate with:
This will generate
Gakubuchi supports some template engines:
When you want to use
Slim, you need to put them in your Gemfile:
# Use Haml gem 'haml' # Use Slim gem 'slim'
Gakubuchi enables you to use assets (e.g.
Note that you may need to add them to the precompile array in
Rails.application.config.assets.precompile += %w(error.css error.js)
You can also use helpers provided by
Sprockets::Rails::Helper in static pages.
Examples of them are given below.
If you want to get the list of all available helpers, please execute the following code.
config/initializers/gakubuchi.rb, you can configure the following values.
leave_digest_named_templates # false by default template_directory # 'templates' by default
You should follow the steps below.
- Fork the repository
- Create a feature branch:
git checkout -b add-new-feature
- Commit your changes:
git commit -am 'Add new feature'
- Push the branch:
git push origin add-new-feature
- Send us a pull request
bundle install appraisal install # Run RSpec with a specific combination appraisal 'sprockets-rails 3 with sprockets 4' rspec # Run RSpec with all combinations appraisal rspec
MIT License. Copyright 2015 Yuichi Goto.