My rail style sheets are not loading / working

Some time has passed since I developed Rails, and it’s hard for me to get any stylesheet scssto work with my newly created rail.

layouts/application.html.erbhas a default value at the <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>top.

For testing purposes, I created a file main.scssin assets/stylesheets/that looks like this:

* {
border: 1px solid black;
}

I thought the file application.scssshould capture all the stylesheets in the folder and child folders, but that is not the case. (Oddly enough, downloading files is .jsfine.)

I tried RAILS_ENV=production rake assets:precompilebut did nothing. Can someone explain what he is doing?

I tried adding *= require mainand *= require main.scssin application.scss. I even changed the ext file to css for both files. The only way I got CSS rendering is to simply add code to application.scsswhich I don't want to do.

Please help me with this.

EDIT 1

I am going to add more information as I get general answers. I mentioned that this is a new application for rails, so the basic things have already been created in advance. Here's what mine looks like application.scss:

/*
 * This is a manifest file that'll be compiled into application.css, which will include all the files
 * listed below.
 *
 * Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
 * or any plugin vendor/assets/stylesheets directory can be referenced here using a relative path.
 *
 * You're free to add application-wide styles to this file and they'll appear at the bottom of the
 * compiled file so the styles you add here take precedence over styles defined in any styles
 * defined in the other CSS/SCSS files in this directory. It is generally better to create a new
 * file per style scope.
 *
 *= require_tree .
 *= require main
 *= require_self
 */

Still nothing works.

+4
source share
5 answers

, - @import main; application.scss. , ( ?).

, , , .

+1

, , , Rails , .

HEAD

<%= stylesheet_link_tag    params["controller"], media: 'screen' %>

css/SASS/Scss app/assets/stylesheets/.

, . Grr.

+2
in your application.css, try adding 
    *= require main
    *= require_self

hope this helps
+1

, application.scss stylesheets , . ( ,.js .)

*= require_tree . application.scss, , , .

0

Rails 4:

, Gemfile sass-rails

# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'

// /main.scss, !

application.scss, :

@import "main";

:

@import "bootstrap";

application.css - , .

, , , , . , , Rails 4

0
source

All Articles