FontAwesome Free

Add fontawesome free to your Rails app
Icons/chart bar
Used 319 times
Created by
R Richard Wise

Usage

Run this command in your Rails app directory in the terminal:

rails app:template LOCATION="https://railsbytes.com/script/VZgskX"
Template Source

Review the code before running this template on your machine.

# install fontawesome-free via yarn
run "yarn add @fortawesome/fontawesome-free"

# create css folder and application.scss
run "mkdir app/javascript/css"
run "touch app/javascript/css/application.scss"

# add reference to fontawesome-free to application.scss
inject_into_file 'app/javascript/css/application.scss' do <<~EOF
	@import '@fortawesome/fontawesome-free';
    EOF
end

# add requre of css/application.scss && import of fontawesome-free to application.js
inject_into_file 'app/javascript/packs/application.js' do <<~EOF
  require("css/application.scss")
  import "@fortawesome/fontawesome-free/js/all"
  EOF
end
Comments

Sign up or Login to leave a comment.