Rails does not compile stylesheets in development after assets have been precompiled

I ran a command rake assets:precompilein my console, after which my stylesheets stopped compiling in my application.css file when I switch to localhost: 3000 ...

Previously, everything was perfect in development mode: write a stylesheet, ask for it in the application.css file, and then see the styles displayed in my view. So the conveyor is used to it.

What I did to make it work (and failed) using other answers to SOF:

  • In config / application.rb I addedconfig.assets.enabled = true
  • in config / development.rb I added the following:

    • config.serve_static_assets = falseso Rails doesn't look for my stylesheet in the public / assets folder
    • config.assets.compress = false
    • config.assets.debug = trueto see traces of downloadable css
    • config.assets.compile = true
  • I deleted the folder public/assetscreated after launch rake assets:precompile- another way to delete folders is to run the command bundle exec rake assets:clobber, but this did not solve the problem.

  • I delete the folder tmp/cache
  • restarted my server and cleared the browser cache every time I tried to execute sequence 1 through 4
  • tried changing the order in which i need my stylesheets in application.css

To no avail ...

I also have the following setting

  • application.html.erb

    <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %>

  • application.css

    * = self required

    * = require_tree.

    * = requires custom

    * = sidebar required

    * = require flags / basic

    * = require flags / flags16

    * = require flags / flags32

    * = require font-awesome.min

In application.css in the browser, I see the following:

enter image description here

rake assets:precompile ? , 5 , , , , , ...

+4
2

. - bundle exec rake assets:clobber. Rails 3 assets. , Rails 4 ( ). .

, , :

RAILS_ENV=production bundle exec rake assets:precompile

, clobber.

, , - . . . , , Safari Safari | Reset..., .

+6

public/assets , :

0

Source: https://habr.com/ru/post/1547087/


All Articles