foundation / foundation-rails

Foundation for Rails
foundation.zurb.com
MIT License
1k stars 376 forks source link

wefit_admin.js:1 Uncaught Error: Sprockets::FileNotFound: couldn't find file 'foundation' with type 'application/javascript' #212

Closed duyetpt closed 3 weeks ago

duyetpt commented 7 years ago

When I add the gem in my engine, gemspecs as follow

 s.add_dependency "rails", "~> 5.0.0", ">= 5.0.0.1"

  s.add_dependency 'haml'
  s.add_dependency 'haml-rails'
  s.add_dependency 'sass-rails'
  s.add_dependency 'uglifier', '>= 1.3.0'
  s.add_dependency 'jquery-rails'
  s.add_dependency 'foundation-rails'

my_engine.js as follow

//= require jquery
//= require jquery_ujs
//= require foundation
//= require_tree .

$(document).foundation();

I setup engine.rb as follow

initializer 'WefitAdmin precompile hook', group: :all do |app|
      root_foundation_gem = Gem.loaded_specs['foundation-rails'].full_gem_path
      Dir.glob("#{root_foundation_gem}/**/").each do |path|
        app.config.assets.paths << path
      end

      app.config.assets.precompile += %w(my_engine/my_engine.css my_engine/my_engine.js)
    end

When i run with development mode, my site can load css file, but cause error when load js file. I check foundation gem directory and see foundation.js.es6. So i think maybe the file is not precompiled.

mrkrlli commented 7 years ago

Facing a similar issue here