Compass Rails 3.0 working with 'compass watch' but not without - ruby-on-rails-3

I'm trying Compass with Rails 3.0.7, just trying to get started. Using gem compass-rails. If I put my sass file in app/assets/stylesheets and run 'compass watch', everything works ok: the compiled css is put into public/stylesheets.
However, if I stop 'watch' and rely on Rails to do the compilation, it does not work. Instead, the program looks at the public/stylesheets/sass folder for the input. Furthermore, if a file in that folder has the '#include "compass"' directive, I get an error that the file is not found. How do I force Rails to look in the right place -- app/assets/stylesheets?

Related

rails g creates haml file, need erb files to be generated

I have comfortable-mexican-sofa gem installed for my app. It has haml-rails as its dependency. So when I run rails g scaffold scaffoldname I get files with .haml extension in the view. But I don't want .haml I need .erb files to be generated. How do I do that?
You can set your default template engine as erb.
See the documentation here for changes you can make in your config/application.rb.

How to use WKhtmltopdf Library without using executable

In ruby on rails project.
I am using PDFKit gem for generating pdf reports
PDFKit uses wkhtmltopdf executable which is to be installed on the machine .
And next step to give the path of the executable .
I dont want to use the executable file .because if i use it how to deploy it on server .
the server will need to install it on its local and give the path.
Is it possible to use only library????
The executable is used to wrap the underlying Qt app, so it's technically possible to wrap the library in a gem (using ffi or some other similar lib) but I never heard anybody doing it.
I'm myself bundling the executable with my Rails app, to ship both at once when I deploy (even on Heroku).
To do the same, you can put the binary file in directory (you can call it bin), and configure PDFKit to get the executable where it's at using PDFKit.configure in an initializer for instance (you might wanna check the README).

#import "compass" breaking in asset pipeline rails 3.2.1

I have an application.sass inside app/assets/stylesheets and it has in it:
#import "compass"
When I attempt to launch my development webserver, I get:
Error compiling CSS Asset
Sass::SyntaxError: File to import not found or unreadable: compass.
I am using compass-rails-1.0.0.rc.2 with compass-0.12.rc.1
This probably isn't your problem, but I just ran across the same error message and spent WAY too long trying different versions of compass/compass-rails, thinking it wasn't my fault.
The problem turned out to be that my application.css file wasn't getting run through the sass preprocessor. So I renamed it to application.css.scss and bang! Yours is named .sass, you could check by renaming it to .css.sass, or .css.scss (just to test) and see if you get different results.
Are you upgrading from a pre-asset pipeline version of Rails (e.g. 3.0)? Please make sure that you are requiring the assets group when initializing bundler in your application.rb.
if defined?(Bundler)
# If you precompile assets before deploying to production, use this line
Bundler.require(*Rails.groups(:assets => %w(development test)))
# If you want your assets lazily compiled in production, use this line
# Bundler.require(:default, :assets, Rails.env)
end
Otherwise, for compass to work in development, compass-rails and sass-rails must be outside of the assets group in your Gemfile.

Rails 3.1 precompiled assets breaking javascript remote_forms in production mode

I've fixed all the errors about "xxx" is not compiled and all the assets show up -- when running locally everything works fine:
All ajax requests work
Form submissions use the rails remote tag and fire off properly
However when running in production mode locally (and on Heroku):
Some ajax will work -- however things like PUT's that should be updatating records (and do in dev) don't... They will hit the page but not do the actual database update
Remote forms are completely broken and resulting in regular form submission
The source can be cloned from here: https://github.com/bluescripts/reru_scrum
Maybe I'm miscompiling the assets wrong or maybe I'm missing an appropriate include in my application.js file?
I've been compiling via:
rake assets:precompile
You're missing //= require jquery_ujs in your application.js. This file comes with jquery-rails gem and is responsible besides other things for handling remote links and forms.
Btw, I'd suggest removing .Gemfile.swp from your repo and adding .*.swp to .gitignore.

rails 3 sass compiling

Hello I have one question I have my file main.scss which is in public/stylesheets/scss. In documentation is written:
By default, .sass and .scss files are
placed in public/stylesheets/sass
(this can be customized with the
:template_location option). Then,
whenever necessary, they’re compiled
into corresponding CSS files in
public/stylesheets. For instance,
public/stylesheets/sass/main.scss
would be compiled to
public/stylesheets/main.css.
I have in my gemfile gem 'haml'
And from my view I do sth like this
= stylesheet_link_tag 'main'
And the file is not found when I check the source(there is a file with with information about routing error). I guess that compiling it by hand it is not way to go so how I can make compile scss file to public/stylesheets automatic? What mean in documentation that they are compiled when necessary?
Thanks in advance
Put your .sass or .scss files in public/stylesheets/sass, not public/stylesheets/scss. Then the stylesheets should automatically generate whenever you change the corresponding sass/scss file. The generated stylesheets end up in public/stylesheets/.
Renaming the folder should make it all work.
EDIT: it looks like Rails 3.1 is going to be not only including SASS by default, but it will also be moving most of the stuff found in the public folder to the app folder... so this answer will only apply to versions of rails before 3.1.