V1.3: v0.6.0


  • Add SERVE_STATIC_ASSETS="true" to .env.development and .env.test in order to serve static assets locally.

  • Add require 'hanami/rake_tasks' to Rakefile in order to enable :preload and :environment Rake tasks

  • Rename default_format into default_request_format for all the applications (eg. apps/web/application.rb)

  • Delete all serve_assets occurrences from all the applications (eg. apps/web/application.rb)

  • Create public/ directory at the root of the project (if not already existing)

  • Add public/assets* to .gitignore

  • Rename apps/web/public into apps/web/assets as assets sources

  • Add require 'hanami/assets' at the top of apps/web/application.rb

  • Add include Web::Assets::Helpers into view.prepare block of apps/web/application.rb

  • Change assets configuration into apps/web/application.rb from:

    assets << [
      # 'vendor/javascripts'
    ]
    

    to:

    assets do
      javascript_compressor :builtin
      stylesheet_compressor :builtin
    
      sources << [
        'assets',
        # 'vendor/assets'
      ]
    end
    
  • Add the following code inside the configure :production block of apps/web/application.rb

    assets do
      compile false
      digest  true
    
      # CDN Mode (optional)
      # scheme 'https'
      # host   '123.cloudfront.net'
      # port   443
    end
    

If you have any problem, don’t hesitate to look for help in chat.