How to add a font awesome icon to title - css

So I was wondering if there was a way to have a font awesome icon beside your title like this I want to use the fa fa-pencilicon. This is my code in my head:
<head>
<title><link type="fa fa-pencil" href="fa fa-pencil">Blogger</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
All what shows up in my title is:
<link type="fa fa-pencil" href="fa fa-pencil">Blogger
In my gem file, I have added gem "font-awesome-rails" and ran bundle install.
Am I doing anything wrong? Is there a way to add the pencil icon to the title? Thanks in advance!

Related

Sprockets::FileNotFound; couldn't find file 'selectize.source.css'

I have recently upgraded my app from Rails 4.2.6 to Rails 5.2.3.
I followed the procedure as on Rails Guides
Now, when I try to start my development server, it starts without any error.
But when I hit the URL in the browser an error comes up which says:
Sprockets::FileNotFound in UserSessions#new
Showing /home/pranjal/source/my-app/app/views/layouts/application.html.erb where line #5 raised:
couldn't find file 'selectize.source.css'
Checked in these paths:
/home/pranjal/source/my-app/app/assets/config
/home/pranjal/source/my-app/app/assets/font-awesome
/home/pranjal/source/my-app/app/assets/fonts
/home/pranjal/source/my-app/app/assets/images
/home/pranjal/source/my-app/app/assets/javascripts
/home/pranjal/source/my-app/app/assets/stylesheets
/home/pranjal/source/my-app/vendor/assets/javascripts
/home/pranjal/source/my-app/vendor/assets/stylesheets
...
Extracted source (around line #5):
<!DOCTYPE html>
<html>
<head>
<title>My App</title>
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
</head>
Looks like issue of incompatibility between js and new version of rails try to use/upgrade selectize-rails gem and remove js and css files from repo (if exists).

ActionView::Template::Error (Invalid CSS after "...ound-position: "Something went wrong" error

I am trying to run a project on digital ocean's ububtu droplet. As soon as I try to install a template, I get We're sorry, but something went wrong.
If I look in my error logs, I see
I, [2016-07-30T23:49:55.921388 #9319] INFO -- : Started GET "/" for 73.160.138.220 at 2016-07-30 23:49:55 -0400
I, [2016-07-30T23:49:55.961647 #9319] INFO -- : Processing by HomeController#index as HTML
I, [2016-07-30T23:49:55.983520 #9319] INFO -- : Rendered home/index.html.erb within layouts/application (1.6ms)
I, [2016-07-30T23:49:56.628915 #9319] INFO -- : Completed 500 Internal Server Error in 667ms (ActiveRecord: 0.0ms)
F, [2016-07-30T23:49:56.631911 #9319] FATAL -- :
ActionView::Template::Error (Invalid CSS after "...ound-position: ": expected expression (e.g. 1px, bold), was "[headerposition];"):
11: <title>Christopher G. Mendla - Personal and Professional Site</title>
12:
13: <!-- From ruby begin -->
14: <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
15:
16: <%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
17: <%= csrf_meta_tags %>
app/views/layouts/application.html.erb:14:in `_app_views_layouts_application_html_erb___1821054907133950454_37150040'
I had the site loaded on Digital ocean before with this template. I seem to rememebr that there was a problem with lines 14 and 16 above and I had to do something different but I can't remember what.
The portion of application.html.erb with the stylesheet tags is
<!-- From ruby begin -->
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %>
<%= csrf_meta_tags %>
<!-- From end begin -->
<!-- The following is added to connect the template to ruby -->
<%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" %>
<%= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jqueryui/1.7.2/jquery-ui.min.js" %>
<%= stylesheet_link_tag "style" %> <!-- From template -->
<%= stylesheet_link_tag "style.ie7" %> <!-- From template -->
<%= stylesheet_link_tag "style.responsive" %> <!-- From template -->
<%= javascript_include_tag "script.js" %> <!-- From template -->
<!-- < %= javascript_include_tag "jquery.are-you-sure" %> --> <!-- Dirty form checker -->
<%= javascript_include_tag 'defaults' %>
<%= csrf_meta_tags %> <!-- cross-site request forgery protection parameter -->
I did do rake assets:clobber and rake assets:precompile
assets.rb has
Rails.application.config.assets.compile = true #for Production
Rails.application. config.assets.precompile = ['*.js', '*.css', '*.css.erb'] #for Production
Rails.application.config.assets.precompile += %w[*.png *.jpg *.jpeg *.gif] #for Production
Rails.application.config.assets.precompile += %w(script.js)
Rails.application.config.assets.precompile += %w(script.responsive.js)
Rails.application.config.assets.precompile += %w( style.css )
Rails.application.config.assets.precompile += %w( style.responsive.css )
Rails.application.config.assets.precompile += %w( style.ie7.css )
If I change application.html.erb to simply be <%= yield %> then the site shows up without an error. I can't figure out where the error message is pointing in my css
I do see lines such as the following in style.css but I can't figure out which, if any of those lines is causing the problem
ul.art-vmenu ul a:hover:after
{
background-position: center ;
}
ul.art-vmenu ul a.active:hover:after
{
background-position: center ;
}
ul.art-vmenu ul a.active:after
{
background-position: bottom ;
}

Rails 4 stylesheet_link_tag missing "text/css" in HTML

I'm using the stylesheet_link_tag in rails 4 and the outputted html is missing type='text/css'
I can't seem to find out how to add this to the stylesheet_link_tag.
You can add type option in your stylesheet_link_tag helper:
= stylesheet_link_tag 'application', type: 'text/css'
This should be automatic in your application.html.erb
<head>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" => true %>
</head>

Invalid CSS after ".": expected class name, was "."

When I try to load the sample user page from the rails tutorial, I get this error:
Showing
C:/Sites/rails_projects/sample_app/app/views/layouts/application.html.erb
where line #5 raised: Invalid CSS after ".": expected class name, was
"." (in
C:/Sites/rails_projects/sample_app/app/assets/stylesheets/custom.css.scss:113)
<html>
<head>
<title><%= full_title(yield(:title)) %></title>
<%= stylesheet_link_tag "application", media: "all", "data-turbolinks-track" =>
true %>
<%= javascript_include_tag "application", "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
<%= render 'layouts/shim' %>
I can't seem to figure out what's wrong with how the code is formatted, and I don't see what "." it's referring to.

Stylesheet_link_tag is broken, paths to files not working, can't figure out why for the life of me. Any ideas?

I'm in Rails 3.1, config,assets.enabled is true in config/application.rb
I've got these that aren't working and I can't figure out what I'm doing wrong
<%= stylesheet_link_tag 'blueprint/screen.css', :media => 'screen' %>
<%= stylesheet_link_tag 'blueprint/print.css', :media => 'print' %>
<%= stylesheet_link_tag 'custom', :media => 'screen' %>
This doesn't work either (image doesn't show with abbreviated path to image or the full path)
<%= image_tag("logo.png", :alt => "Sample App", :class => "round") %>
have you put your images in assets/images directory?

Resources