Getting bootstrap-wysihtml5-rails to use font-awesome instead of bootstrap glyphicons - ruby-on-rails

After searching on the Internet for an hour trying to find a simple, how-to write up of how to substitute bootstrap glphicons for font-awesome when using the bootstrap-wysihtml5-rails gem, I came up empty handed. I did find a variety of issues with loading the fonts.
Does anyone have a current write up on how to do this?
Alternatively, perhaps you can help with getting my rails sass app to use both font-awesome and bootstrap icons in parallel so that bootstrap-wysihtml5-rails works. Right now, I am getting an error: "RoutingError (No route matches [GET] "/fonts/bootstrap/glyphicons-halflings-regular.woff")" (localhost - with or without precompiled assets) which many folks have struggled with. I tried the many suggestions here, here, here and others to no avail.
Any and all help is appreciated!

Related

Rails 4 Asset Compilation (w/Sass & Susy) is Slow Using the Asset Pipeline

Basically, I am in the same boat as this question:
Rails 4 asset compilation is VERY slow (>1min) in dev mode. How to troubleshoot?
But instead of using Bootstrap, I'm using Susy 2 with SASS 3.3 and Rails 4.1 (but not Compass). I'm using the Sprockets 'require' in my application.js manifest, and it's not causing any problems...the snail's pace only happens when I make a change to any SASS file. At the moment I'm needing to use the #import rule in my stylesheet manifest.
I have tried variations on the 'require'/'#import' combination, and they have helped a little bit, but I do have a lot of SASS files and I'd love to just have an application.css.scss manifest that uses SASS's compilation method instead of including a 'global' file with an #import at the top of each SASS file.
I'm wondering whether it could have something to do with the current Sprockets/sass-rails gem issues; during compilation I get a lot of
Warning. Error encountered while saving cache 6b6acdc6a4d802b749fef26e565bbfe3caa60193/style.css.scssc: can't dump anonymous class #<Class:0x007ff59c2c8870>
I'd try moving back to SASS 3.2 if I could and still use Susy 2.
I'd be OK with not using the Asset Pipeline if I could be sure that the app would still play nice with Heroku when pushing to staging/production. I am familiar with both Grunt and Gulp, less so with what using Grunt/Gulp instead of the AP would do to my Rails app.
On the one hand, I'm glad that I'm not alone with this problem, but on the other...I'd love to find a way out of it, if anyone has some suggestions to share! Thanks in advance, SO community!

How do I use Twitter Bootstrap with Ruby on Rails 3.2.12?

I'm switching from PHP to Ruby on Rails and I'm loving it, the only thing is I'm so used to Twitter Bootstrap for most of my designs and now I feel crippled without it, I followed some tutorials like adding bootstrap-sass and what not to my Gemfile, but I still appear to be missing important things like input-block-level I'm just curious if there is an updated version or a easier tutorial to follow? Thanks.
AFAIK, the easiest and most rails way to integrate the twitter bootstrap to rails is via
twitter-bootstrap-rails gem, they have a pretty good documentation too.
check these screen casts, and this (premium) to get an idea.
and welcome to Rails :)
To to the input-block-level in ERB do something like this
"input-block-level" => "hello_world"
Same as you, I'm coming from PHP and love RoR ;)
With bootstrap you need to import it in your manifest. Read a bit about the assets pipeline in RoR guide.
To import bootstrap, create a file in your app/assets/stylesheets directory, with the name you want, but with the extension .css.scss, and place in it the following line:
#import "bootstrap";
Also if you need to use the javascript helpers from bootstrap, you need to add the following line in your app/assets/javascript/application.js file:
//= require bootstrap
Just download the bootstrap ( CSS, JS ) file and make the updation in that file at regular interval from his official site : Bootstrap
For Bootstrap Tutorials : Click Here
Or you can refer the sample code for reference, because sometimes we dnt get the way to implement such functionality like tooltip.

Rails 3, Wicked_pdf not picking up styles, print media type, or separate template

So I've been banging my head on this all day yesterday trying to get PDF rendering to work properly. After trying Prawn and PDFKit, I found that the problem with at least getting it to work at all had to do with wkhtmltopdf on Mac OS 10.7, but now the problem is that it completely ignores any styles I add targeting the pdf, the print media type, and any special templates.
Here is a pastebin of where I'm at now: http://pastebin.com/LW16RYjW
Trying all of these and several others didn't work for me:
http://www.snikt.net/blog/2012/04/26/wicked-pdf/
WickedPDF missing layout
http://akabhilash.wordpress.com/2010/11/27/pdf-generation-with-wicked-pdf-in-rails/
I finally got to this setup:
https://github.com/mileszs/wicked_pdf/issues/87
Not knowing what else to do, I physically copied pdf_helper.rb into my lib/ directory (I don't know why it wasn't there before, or even whether it should've been upon bundling(?))
Can anyone tell me why it doesn't seem to be picking up any of the rendering options in the controller, and how I can get the styles to register without affecting the screen (html) version? Any help would be greatly appreciated. Thanks in advance for your time.
Turn off the middleware, or add the route you are trying to customize in the middleware call as documented in the README.

How to use Bootstrap from Twitter in a Rails 3.0 application?

In my rails 3.0.10 I would like to use Bootstrap from Twitter but I only found examples using Rails 3.1 and the Asset Pipeline. How would add it to my 3.0 application? Do I just download it from the main site and put the files inside of my public folder? What about using LESS?
The absolute simplest way is to drop the boostrap.css file into your public folder and then reference it in your layouts/application.html.erb file. Then you can start using it right away. You're a bit limited at that point in what you can modify but that will get you started.
What is your question about LESS? bootstrap uses LESS but you don't have to worry about that since you're just using a plain ole css file.
See this railscasts video: Twitter Bootstrap Basics. There is another follow-up screencast after you finish this one.
We converted bootstrap to use SASS (think I found it in a github repo somewhere), and included it in the lib/assets/ folder.
Our application.css includes the partials. We've made a few custom modifications to the partials, works just fine.
Version 2 will be converted to SASS pretty sure I'm sure, but in the meantime there are asset pipeline modules available for LESS which you could add so that your rails app understands less files:
A quick search found this (can't vouch for it at all)
https://github.com/metaskills/less-rails
If it works as described you could just drop in bootstrap as it is and reference it in your application.css file.

How to use Sprockets 2 with Rails 3.0.x

I'm trying to use these gists to get Sprockets 2.0beta to work with a Rails 3.0.5 app in a similar way to how it works natively in Rails 3.1. Failing thoroughly so far--my app is finding the correct routes and files, and loading the initializer that extends Sprockets::Environment, but it's not parsing the //= require 'phu' lines in my application.js.
Can anyone enlighten me about Sprockets 2 with Rails 3.0?
I have used the same gists as a basis, and it works fine. I have made some changes though.
Maybe you can try that, see if it helps: https://gist.github.com/1112393
ps: I guess you solved it yourself since it's been a month...
I personally have another problem: How to use Sprockets 2 with Rails 3.0.x (how to use precompiled assets)
If you solved it already, or found another way to make this efficient on production, could you help me? Thanks.

Resources