How to make Rails 3.1 use SASS (Over SCSS) as the default?
For rails 3.1.rc4, you could set the config:
config.sass.preferred_syntax = :sass
in the application.rb
file
Compiling Sass with custom variables per request under Rails 3.1
Sim.
It is possible. Look here SASS: Set variable at compile time
I wrote a solution to address it, I'll post soon and push it here, in case you or someone else still need it.
Rails 3.1: Adding .scss stylesheets
Try adding a style.css
file to your assets/stylesheets/
directory that looks like this:
/*
*= require style.css.scss
*/
That should automatically convert your style.css.scss
to plain CSS and include it in what /assets/style.css
returns.
Precompiling a .scss manifest file using Rails 3.1's asset pipeline
Include the compiled filenames in your precompile list:
config.assets.precompile += %w( user.css admin.css )
Also, you may want to to rename the original files in app/assets/stylesheets
to include the compiled extension in the original filenames so it's clear what is going on:
user.scss -> user.css.scss
admin.scss -> admin.css.scss
Rails 3.1 SCSS - Can I invoke SASS functions inside a SASS for loop?
Got it.
@for $j from 0 through 4{
.Bar#{$j}{
@extend .Bar;
background-color:mix($background-color, #2C5999, (10-$j)*10%);
}
}
Why does rails 3.1 and 3.2.0.rc2 create an application.css instead of an scss?
I would just rename it to application.scss
and then you can import in your other .scss
files like this:
// Inside application.scss
// HTML Reset
@import "reset.scss";
// Users CSS
@import "users.scss";
When you compile the SCSS, it will generate the application.css
for you from all of the other imported files or CSS within that file.
Configuring generator to generate .scss file instead of css
On May 24, 2011, SCSS generators were moved out from Rails, and put into Sass Railtie.
See this commit.
This means in your application, you need to include sass-rails
gem in your Gemfile to get the generator working correctly. In other words, it's not enough to simply include sass
gem to get the generator working.
When SCSS is finally generated, your stylesheet will look something like mystylesheet.css.scss
.
By default, SCSS is used.
Related Topics
Railstutorial - Chapter 8.4.3 - Test Database Not Clearing After Adding User in Integration Test
Render Three Different Partials Depending on Button Clicked
What Are <-- Ruby Strings Called? and How to Insert Variables in Them
Is Everything an Object in Ruby
Ruby - Send Get Request with Headers
Error: Failed to Build Gem Native Extension (Ruby Extconf.Rb): MAC Osx
Unix Commands Work on Server But Not in Ruby Ssh Session
Uninitialized Constant "Controller Name"
How to Handle a Thread Issue in Zeromq + Ruby
Trouble Yielding Inside a Block/Lambda
Do I Have to Manually Uninstall All Dependent Gems
Undefined Method 'Model_Name' for Project:Class
Howto Rank Items by Balance in Ruby on Rails