Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to use Pro Icons #185

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,40 @@ Prepend the style of the icon you want to use (`fas`, `far`, `fab`) class to exi
```html
<i class="fab fa-github"></i>
```


## Using FontAwesome Pro

Assuming you have purchased fontawesome pro and want to use Rails asset pipeline.

First login to fontawesome and go to the download section. You will see two options in the download seaction, they are "Web" and "Desktop". Click on "Pro for Web" and download it. Unzip it to any tempory folder.

#### Step 1

* Copy **"./css/all.css"** to you project's stylesheets directory and rename it **"app/assets/stylesheets/fontawesome.css"**
* Copy **"./js/all.js"** to your project's javascripts directory and rename it **"app/assets/javascripts/fontawesome.js"**
* Copy all the fonts from **"webfonts"** folder and place them in **"app/assets/webfonts"** folder (or just copy over the entire folder)

#### Step 2

**Remove** any css settings you have done for this gem such as
* @import 'font-awesome-sprockets';
* @import 'font-awesome';

Edit file **"app/assets/stylesheets/fontawesome.css"**
Search **"../webfonts/"** and replace with **"/assets/"**

#### Step 3

Add the following to **"config/initializers/assets.rb"**
```ruby
Rails.application.config.assets.paths << Rails.root.join('app', 'assets', 'webfonts')
Rails.application.config.assets.precompile += %w[.svg .eot .woff .woff2 .ttf]
```
In the class Application. And thats it.
Test it with `icon(:far, 'tachometer-alt-average')` which is a pro icon.

#### Production

In production don't forget to compile the assets using
`bundle exec rails assets:precompile`