FontAwesome Pro

Add fontawesome pro to your Rails app
Icons/chart bar
Used 36 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/zl0s7z"
Template Source

Review the code before running this template on your machine.

token = ask('What is your FontAwesomePro token?')

# register your token for fontawesome pro
run "npm config set '@fortawesome:registry' https://npm.fontawesome.com/ && \
  npm config set '//npm.fontawesome.com/:_authToken' #{token}"

# install fontawesome-pro via yarn
run 'yarn add @fortawesome/fontawesome-pro'

# create javascript/css folder and application.scss file
run 'mkdir app/javascript/css'

# add fontawesome pro to your application.scss file
run 'touch app/javascript/css/application.scss'
inject_into_file 'app/javascript/css/application.scss' do <<~EOF
	@import '@fortawesome/fontawesome-pro';
    EOF
end

# add fontaswesome to to your application.js file
inject_into_file 'app/javascript/packs/application.js' do <<~EOF
  require('css/application.scss')
  import '@fortawesome/fontawesome-pro/js/all'
  EOF
end
Comments

Sign up or Login to leave a comment.