Rails 6 and Foundation

Many posts complain about the Rails Foundation gem not working as smoothly in Rails 6 as it used to work in Rails 5. The issue is related to the final installation command and the fact that Rails 6 uses Webpack to handle Javascript.

So, I have written a shell script that brings a lot of goodies together that make life for the programmer much easier.

The script perform the following functions:

  • Install husky (Husky - Git hooks)
  • Add license(s) to the package.json file. By default, rails new project_name does not add a license mention in that file.
  • Add the Hotwire bundle and runs its installer. That installs/update the Stimulus code an bin/rails app:template LOCATION='https://railsbytes.com/script/X6ksRW'
    d add the new Turbo system (GitHub - hotwired/hotwire-rails: Use Hotwire in your Ruby on Rails app).
  • Add coffeescript webpack.
  • Add the haml-rails gem
  • Add prettier and eslint webpack.
  • Install and Configure the Zurb Foundation using
    bin/rails app:template LOCATION='https://railsbytes.com/script/X6ksRW'
    -Add the airbnb esling ruleset.
  • Convert all existing .erb files to .haml files.
  • Add .esling.json and .prettierrc with configuration data.
  • And that’s all folks!!

To use this script, it’s pretty simple.

Assuming your development directory is ~/development, place the raisseup.sh file in that directory. Create your Ruby on Rails projet, enter the newly created directory and run …/railssetup.sh.

cd ~/development
rails new my_project
cd my_project
../railssetup.sh

I will respond to myself and try to enclose the railssetup.sh file.

You’ll find the railssetup.sh here: