Ruby on Rails Developers Forum

For all Ruby on Rails (RoR) Expert Developers Programmers Coders
Ruby on Rails PHP .Net Developers Community, Nyros Technologies, Kakinada
 
Log in  or IF not a member please REGISTER
Username:
Password:   


Keyword
Log in | Profile 

Solution for the Sass issue on heroku deployment

 
Post new topic   Reply to topic    Ruby on Rails Developers Forum Index -> Deployment
View previous topic :: View next topic  
Author Message
vijayalakshmi



Joined: 27 Nov 2009
Posts: 38

PostPosted: Tue Nov 29, 2011 11:01 am    Post subject: Solution for the Sass issue on heroku deployment Reply with quote

Hi All,

Deploying rails application into heroku is quite easiest way of maintaining it and Using Haml-Sass will increase the performance of the application.

But the combination of Haml-Sass and Heroku become a big headach because Sass will generate css files on fly and store them in 'app/stylesheets' the problem is Heroku will write protect the folders on fly.As a result we used to get 'permission-denied' error on heroku logs.

To over come this problem, on googling I found a gem 'compass'.
This will store the Sass generated file on tmp folder instead of "stylesheets" and serve them on production mode using the Rack::Static and Rack::Sendfile middle-wares.

Note: tmp folder is not write protected on heroku.

Here is the process for installing the gem:

Add the following in your gem file:

>gem 'compass'
>gem 'haml', '3.1.4'

In config/compass.rb file:

project_type = :rails
http_path = '/'
css_dir = 'tmp/stylesheets'
sass_dir = 'app/views/stylesheets'

In the config/initializers/compass.rb file :

require 'fileutils'
FileUtils.mkdir_p(Rails.root.join("tmp", "stylesheets"))

Rails.configuration.middleware.insert_before('Rack::Sendfile', 'Rack::Static',
:urls => ['/stylesheets'],
:root => "#{Rails.root}/tmp")

Bundle install and run the server.'Smile'



Thank You,
VijayaLakshmi.V
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Ruby on Rails Developers Forum Index -> Deployment
Page 1 of 1

 latest topics 
 Topics   Replies   Author   Views   Last Post 
No new posts PROBLEMS CREATING AN SSH TUNNEL
0 clem_c_rock 7209 Tue May 07, 2013 6:18 pm
clem_c_rock View latest post
No new posts Module Control
0 mpiaser 732 Sun May 05, 2013 4:12 am
mpiaser View latest post
No new posts Difficulty in learning ruby and rails
8 moneysharma 5849 Sat Apr 20, 2013 6:37 am
lucyming View latest post
No new posts Implementing SEO in rails
1 Rohini Pamarty 3071 Sat Apr 20, 2013 6:36 am
lucyming View latest post
No new posts RVM installation on ubuntu 10.04 version.
2 konduri subrahmanyam 3963 Sat Apr 20, 2013 6:35 am
lucyming View latest post
No new posts How to connect to remote databases in Ruby ?
1 ranjit_nyros 2724 Tue Apr 16, 2013 7:50 am
liveproject101 View latest post
No new posts Install Safari & IE in Ubuntu
2 Anu Krishna 3500 Thu Apr 04, 2013 6:52 am
chrisluger2012 View latest post
No new posts Saving the files in a zip folder using "rubyzip"
0 ranjit_nyros 5358 Thu Mar 14, 2013 5:23 pm
ranjit_nyros View latest post
No new posts [SOLVED]: A must after the installation of phpmyadmin
0 ranjit_nyros 1445 Thu Mar 14, 2013 4:52 pm
ranjit_nyros View latest post
No new posts Cropping Images with Carrierwave + rmagick
0 ranjit_nyros 1425 Thu Mar 14, 2013 4:37 pm
ranjit_nyros View latest post




Hire an expert Ruby on Rails developer / coder / programmer or development team from India now!!

Other Forums : PHP   ::   .Net   |   Free unlimited HTML CSS templates download

Nyros Technologies   |   Kakinada City Portal   |   Developers Blog   |   About Ruby on Rails Experts   |   More