How do I remove SASS from a rails project? - ruby-on-rails

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

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.

Do I have access to the raw sass files using the bootstrap-rubygem gem?

I added the bootstrap-rubygem gem to my rails 5 application.
In my application.scss file I added:
#import "bootstrap";
Do I have access to the scss files that bootstrap uses? It is possible to install them so I can manually update them?
You have access to the scss files and you can change the variables, but the documentation is based on the latest version of Bootstrap v4.0.0-beta.3.
The bootstrap-rubygem uses different versions of bootstrap from the latest v4.0.0.beta3 to previous oldest alpha versions.
As explained in the documentation this is the files structure of the bootstrap project,
The scss files and partials from the twitter-bootstrap github repository are included in your bootstrap-rubygem assets/stylesheets/bootstrap folder so they will probably be available to you inside your rbenv or rvm folder.
I discourage you in going into the bootstrap source to edit those files, it is discouraged in the docs itself, instead use scss variables, functions and mixins as described in their documentation
https://getbootstrap.com/docs/4.0/getting-started/theming/#variable-defaults
I notice now that v4.0.0beta3 is available with the bootstrap-rubygem, as in my last probject I installed it with yarn and the files are included in /node-modules, but I don't really believe it is an advantage if the gem does not have bugs.

Rails Sass extension for indented sass

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?

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?

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