css - Glyphs and font not loading for designmodo flat-ui in Rails -
i'm trying import designmodo's flat-ui (free version) css , js rails project.
i cannot use gem(s) library because elements not work (i'm assuming gem(s) outdated).
i've dropped off .css , .js files vendor/assets/, fonts , glyphicons. did same thing bootstrap dist/ files i'm assuming method correct.
when tried load glyphs , font in application.css.scss file how bootstrap glyphs:
@font-face { font-family: 'glyphicons halflings'; src: url('../assets/glyphicons-halflings-regular.eot'); src: url('../assets/glyphicons-halflings-regular.eot?#iefix') format('embedded-opentype'), url('../assets/glyphicons-halflings-regular.woff') format('woff'), url('../assets/glyphicons-halflings-regular.ttf') format('truetype'), url('../assets/glyphicons-halflings-regular.svg#glyphicons_halflingsregular') format('svg'); } the console in chrome gives me bunch of 404 not found errors fonts , glyphs. how tried loading flat-ui glyphs:
@font-face { font-family: 'flat-ui-icons'; src: url('../assets/flat-ui-icons-regular.eot'); src: url('../assets/flat-ui-icons-regular.eot?#iefix') format('embedded-opentype'), url('../assets/flat-ui-icons-regular.woff') format('woff'), url('../assets/flat-ui-icons-regular.ttf') format('truetype'), url('../assets/flat-ui-icons-regular.svg#glyphicons_halflingsregular') format('svg'); } and how tried load flat-ui font:
@font-face { font-family: 'lato'; src: url('../assets/lato-black.eot'); src: url('../assets/lato-black.eot?#iefix') format('embedded-opentype'), url('../assets/lato-black.woff') format('woff'), url('../assets/lato-black.ttf') format('truetype'), url('../assets/lato-black.svg#latoblack') format('svg'); font-weight: 900; font-style: normal; }
i banged head gem more 2 hours.
edit: fonts included in gem , work way. no need declare them explicitly.
here's complete working solution. assume using rails 4.
gemfile:
gem 'flat-ui-sass', github: 'wingrunr21/flat-ui-sass' gem 'bootstrap-sass', '~> 3.3.5' gem 'sass-rails', '~> 4.0' gem 'jquery-rails' sass-rails >= 4.2 not supported flat-ui-sass gem.
hit bundle command.
add application.css.scss
@import "flat-ui/variables"; @import "bootstrap-sprockets"; @import "bootstrap"; @import "flat-ui"; add application.js
//= require jquery //= require jquery_ujs //= require bootstrap-sprockets //= require flat-ui //= require_tree . some commands:
cd [your app directory]
mkdir app/assets/fonts
cp -r $(bundle show flat-ui-sass)/vendor/assets/images/ app/assets/images
cp -r $(bundle show flat-ui-sass)/vendor/assets/fonts/ app/assets/fonts/
cp -r $(bundle show flat-ui-sass)/vendor/assets/javascripts/ app/assets/javascripts/
that's it. should , running flat-ui on rails.
a helper trick glyphs: flat ui sass (ruby gem)
fui_icon "heart" # => <i class="fui-heart"></i> fui_icon "heart", tag: :span # => <span class="fui-heart"></span> fui_icon "heart", text: "flat-ui!" # => <i class="fui-heart"></i> flat-ui! fui_icon "arrow-right", text: "get started", right: true # => started <i class="fui-arrow-right"></i> fui_icon "photo", class: "pull-left" # => <i class="fui-photo pull-left"></i> fui_icon "user", data: { id: 123 } # => <i class="fui-user" data-id="123"></i> content_tag(:li, fui_icon("check", text: "bulleted list item")) # => <li><i class="fui-check"></i> bulleted list item</li>
Comments
Post a Comment