Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

foundation-rails 6.3.1.0 breaks with Sprockets upgrade to 4.0.0 #294

Open
robjlucas opened this issue May 27, 2020 · 5 comments
Open

foundation-rails 6.3.1.0 breaks with Sprockets upgrade to 4.0.0 #294

robjlucas opened this issue May 27, 2020 · 5 comments

Comments

@robjlucas
Copy link

robjlucas commented May 27, 2020

foundation-rails 6.3.1.0 breaks after upgrading Rails from 5.2.4.1 to 5.2.4.3, unable to find the main Foundation js file. Specifically, it is the upgrade of sprockets from 3.7.2 to 4.0.0 that causes this to break.

ActionView::Template::Error (couldn't find file 'foundation' with type 'application/javascript'
Checked in these paths: 
  /SomeProject/vendor/bundle/gems/babel-source-5.8.35/lib
  /SomeProject/app/assets/components
  /SomeProject/app/assets/config
  /SomeProject/app/assets/images
  /SomeProject/app/assets/javascripts
  /SomeProject/app/assets/stylesheets
  /SomeProject/vendor/assets/fonts
  /SomeProject/vendor/assets/javascripts
  /SomeProject/vendor/assets/stylesheets
  /SomeProject/vendor/bundle/gems/foundation_emails-2.2.1.0/vendor/assets/stylesheets
  /SomeProject/vendor/bundle/gems/chart-js-rails-0.1.6/vendor/assets/javascripts
  /SomeProject/vendor/bundle/gems/chartkick-3.3.0/vendor/assets/javascripts
  /SomeProject/vendor/bundle/gems/rails_sortable-1.2.1/vendor/assets/javascripts
  /SomeProject/vendor/bundle/gems/jquery-ui-rails-6.0.1/app/assets/images
  /SomeProject/vendor/bundle/gems/jquery-ui-rails-6.0.1/app/assets/javascripts
  /SomeProject/vendor/bundle/gems/jquery-ui-rails-6.0.1/app/assets/stylesheets
  /SomeProject/vendor/bundle/gems/foundation-rails-6.3.1.0/vendor/assets/_vendor
  /SomeProject/vendor/bundle/gems/foundation-rails-6.3.1.0/vendor/assets/js
  /SomeProject/vendor/bundle/gems/foundation-rails-6.3.1.0/vendor/assets/scss
  /SomeProject/vendor/bundle/gems/jquery-rails-4.3.3/vendor/assets/javascripts
  /SomeProject/vendor/bundle/gems/coffee-rails-4.2.2/lib/assets/javascripts
  /SomeProject/vendor/bundle/gems/actioncable-5.2.4.3/lib/assets/compiled
  /SomeProject/vendor/bundle/gems/activestorage-5.2.4.3/app/assets/javascripts
  /SomeProject/vendor/bundle/gems/actionview-5.2.4.3/lib/assets/compiled
  /SomeProject/vendor/bundle/gems/turbolinks-source-5.2.0/lib/assets/javascripts
  /SomeProject/app/assets/components
  /SomeProject/vendor/fonts
  /SomeProject/node_modules):

I'm sure it's something simple I'm missing, but several hours of searching and fiddling haven't brought it to light. There are various significant changes with the new version of Sprockets; though I don't see the immediate cause as yet.

app/assets/javascripts/application.js requires foundation as before, and as specified in the docs:

//= require jquery
//= require jquery_ujs
//= require jquery-ui/widgets/sortable
//= require rails_sortable
//= require foundation
//= require turbolinks
...

app/assets/config/manifest.js:

//= link_tree ../images
//= link application.js
//= link application.css
@robjlucas robjlucas changed the title foundation-rails 6.3.1.0 breaks with Rails upgrade to 5.2.4.3 foundation-rails 6.3.1.0 breaks with Sprockets upgrade to 4.0.0 May 27, 2020
@robjlucas
Copy link
Author

On further investigation I increasingly suspect this is something to do with ES6, but still don't have a solution.

@joeworkman
Copy link
Member

This issue has been mentioned on Foundation Open Source Community. There might be relevant details there:

https://foundation.discourse.group/t/foundation-with-rails-and-sprockets-4/2692/1

@DanielRuf
Copy link
Contributor

It looks like it misses some file extension. Can you provide a reproducible testcase as repository with the needed steps to run it?

@robjlucas
Copy link
Author

robjlucas commented Jun 1, 2020

It looks like it misses some file extension. Can you provide a reproducible testcase as repository with the needed steps to run it?

Thanks @DanielRuf. It'll take me a few days at least, but I'll do my best to do that asap.

@frenkel
Copy link

frenkel commented Dec 2, 2021

The problem seems to be that the .js.es6 file extensions used in this gem are not recognized by Sprockets. You can work around this error by creating an initializer: config/initializers/foundation-rails.rb with the following contents:

Sprockets.register_mime_type 'application/ecmascript-6', extensions: ['.es6', '.js.es6'], charset: :unicode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants