Rails Sass extension for indented sass - ruby-on-rails

Rails comes with SASS included, but generated files come with .scss extension. I want to use indented version of SASS. Should I just rename .scss extension to .sass and that will do the trick? or should I do some extra dances to make it work?

Related

Rails sass import css file is not working on staging

I have a .css file in
vendor/assets/stylesheets/myfile.min.css
I am trying to refer to that file from my main.css.scss file
#import 'myfile.min.css';
This works on localhost but not on staging.
On my application.rb I have
config.sass.load_paths << Rails.root.join("vendor","assets","stylesheets");
But the file is not been found on staging.
As far as I'm aware, you can't import regular CSS files with Ruby's SASS implementation. I follow Node's SASS implementation more closely, and they just recently tried to disable this functionality stating it doesn't align with the SASS spec.
You should look into Rails' asset pipeline. You would add something like this to the top of your main.css.scss
//= require myfile.min
This puts the import burden on Sprockets, leaving SASS to do it's own thing afterward.

Serving .scss files on rails development environment

I'm using RubyMine together with a ruby/rails project where .scss files are joined to one applcation.scss and then compiled to one application.css file which is served.
I would like to serve the .scss file too, but just in the development so I will be able to edit the .scss file in chrome dev tools without the need to refresh and won't need to go back to the ruby mine to update the .scss file.
How do I serve the application.scss too then?
If you're using Rails 4, you can install and follow the instructions for the sass-rails-source-maps gem. Then you should be able to see/edit .scss files in Chrome's web inspector.

addressing asset stylesheets with file extensions

I have some stylesheets in a subfolder /app/assets/stylesheets/themes of my rails app. These assets have the file extension .css.scss extension.
In my development environment I've been addressing those files with:
asset_path 'themes/theme-name.css.scss'
However, when I go to production Rails won't find those files. When I use just .css extension it seems to be working okay:
asset_path 'theme/theme-name.css'
My question is: what is the correct way to address asset files with multiple extensions?
Thanks for help
The correct way should be:
stylesheet_link_tag 'themes/theme-name'
If Rails is configured correct, the assets pipeline will figure out the file extensions itself .
Do you have sass loaded in your Gemfile?

How do I remove SASS from a rails project?

I have forked a rails project and found that is uses SASS, I want to remove SASS and write my css by hand.
Can i just delete the folder:public/stylesheets/sass? Remove the gem from the gemfiles, and then continue with the .css files that sass has generated?
Since there is already generated SASS, the method you suggest is the best. You do not want the SASS files overwriting your CSS.
The files with .css extension have no treated by gem sass, you can write your .css file think to change stylesheet_link_tag in layout for load your .css

Referencing a SASS file from HAML

How do I reference a .sass file from a .haml file?
I have the following haml expression that will reference a .css file:
%link{'href' => '/stylesheets/layout.css?cache=1', 'rel' => 'stylesheet', 'type' => 'text/css'}/
How do I reference a .sass file?
Sass files compile to CSS files. If you're using Rails, this is done automatically; otherwise, you can use the sass command-line executable. Check out the Sass documentation for more information.
Once you've compiled your Sass files to CSS, you reference the CSS file just like you normally do.
try using the stylesheet_link_tag method
stylesheet_link_tag "layout"

Resources