swaggard icon indicating copy to clipboard operation
swaggard copied to clipboard

The asset "application.css" is not present in the asset pipeline.

Open csivladislavbakan opened this issue 7 years ago • 7 comments

Create test rails application and add swaggard gem to gemfile (swaggard configuration doesn't matter, it happens anyway). Any route opening causes error "The asset "application.css" is not present in the asset pipeline." There is stack trace

app/views/layouts/application.html.erb where line #7 raised:

5    <%= csrf_meta_tags %>
6
7    <%= stylesheet_link_tag    'application', media: 'all', 'data-turbolinks-track': 'reload' %>
8    <%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>
9  </head>

And it's my gemfile

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
  "https://github.com/#{repo_name}.git"
end

gem 'rails', '~> 5.1.2'
gem 'sqlite3'
gem 'puma', '~> 3.7'
gem 'sass-rails', '~> 5.0'
gem 'uglifier', '>= 1.3.0'

gem 'swaggard'

gem 'coffee-rails', '~> 4.2'
gem 'turbolinks', '~> 5'
gem 'jbuilder', '~> 2.5'

group :development, :test do
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
  gem 'capybara', '~> 2.13'
  gem 'selenium-webdriver'
end

group :development do
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

csivladislavbakan avatar Aug 03 '17 13:08 csivladislavbakan

I think, i found issue. In Swaggard gem file lib/swaggard/engine.rb contains next line of code: initializer 'swaggard.finisher_hook', after: :finisher_hook do |app| I'm not familiar with it, but i just deleted finisher_hook and it started work for me. Now this line seems like initializer 'swaggard.finisher_hook' do |app| Could you please explain what finisher_hook does and why it has this strange impact. Thanks in advance

vladislavbakan avatar Aug 06 '17 20:08 vladislavbakan

This bit us when upgrading a rails 4.2 app to rails 5.1 - completely broke the app and it wasnt obvious it was swaggard causing the issue (it looks like its to do with the asset pipeline).

nicpillinger avatar Oct 16 '17 10:10 nicpillinger

This might be useful: https://github.com/rails/sprockets-rails/pull/388

nicpillinger avatar Oct 16 '17 15:10 nicpillinger

Same issue here. Is there a fix for this one?

software-project avatar Dec 06 '17 19:12 software-project

You can change one line in lib/swaggard/engine.rb (initializer 'swaggard.finisher_hook', after: :finisher_hook do |app| -> initializer 'swaggard.finisher_hook' do |app|) or just use my fork

csivladislavbakan avatar Dec 07 '17 07:12 csivladislavbakan

@csivladislavbakan your fork causes different error with warden undefined method failure_app=' for nil:NilClass (NoMethodError)

software-project avatar Dec 07 '17 15:12 software-project

To me this was still an issue. Added PR #50 to solve this.

johan-smits avatar May 07 '20 11:05 johan-smits