37

Even if config.assets.digest = false is set Sprockets 3.0 keep adding .self. to all static files: application.css becomes application.self.css?body=1

How to disable adding self? It is needed for correct browsersync work.

Dmitrii Dushkin
  • 3,070
  • 4
  • 26
  • 37
  • Did you manage to fix it already? Running into the same problem .. – Loed May 02 '15 at 08:55
  • 2
    I've fixed it by downgrading Sprockets to 2.x release in gemfile.( – Dmitrii Dushkin May 04 '15 at 16:35
  • Does it make sense to raise an issue on [GitHub](https://github.com/rails/sprockets/issues)? – spickermann May 20 '15 at 21:27
  • It is already reported as a bug. If you need to keep 3.0, the entire page can be captured in a buffer, and the '.self' stripped out or you can copy/link the files to be file.self.ext as well – ppostma1 May 22 '15 at 13:17
  • @Dimitry Answer your own question with the updated infos you have. You should not leave it unanswered. – Ely Jun 16 '15 at 01:43

2 Answers2

18

In Sprockets 3, .self.css is added because you have the config.assets.debug = true config set (not the digest config, that's unrelated).

If you add the following to your development.rb or production.rb file, it will work as you expect:

config.assets.debug = false
fotinakis
  • 7,792
  • 2
  • 26
  • 28
  • 1
    The thing is, this than conactenates all files into one file. Individual debugging of files in browser is no longer possible. – Kazim Zaidi Jun 08 '17 at 13:18
1

Downgrading sprockets worked for me. Add the following to your Gemfile

gem 'sprockets', '2.11.0'

and run

bundle update sprockets
david_adler
  • 9,690
  • 6
  • 57
  • 97