vijayalakshmi
Joined: 27 Nov 2009 Posts: 38
|
Posted: Tue Nov 29, 2011 11:01 am Post subject: Solution for the Sass issue on heroku deployment |
|
|
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.' '
Thank You,
VijayaLakshmi.V |
|