2

I am trying to install a plugin called Chaffel.js, I have added it to my javascript file

+app
|+assets
||+javacripts
|||chaffle.min.js
|||

I have required it in application.js

//= require chaffle.min.js
//= require rails-ujs
//= require turbolinks
//= require_tree .

And I have also added this to config/initializers/assets.rb

Rails.application.config.assets.precompile += %w(chaffle.min.js)

And I have included it in my view

<%= javascript_include_tag 'chaffel.min' %>

And have added all the html / javascript it showed for the example but when I load up the view it gives me this error

Sprockets::Rails::Helper::AssetNotFound in Home#index
The asset "chaffel.min.js" is not present in the asset pipeline.

I don't know if it is a problem with my asset pipeline or if the plugin just doesn't work anymore (As the cdn src on its page doesn't seem to work either) Would love some help with this or recommendations for a different plugin/way to achieve the same effect (a text shuffle animation).

I was able to get it working in a normal html file by just directly including the file via

<script src="chaffle.min.js" charset="utf-8"></script>

So it is definitely a problem with my code / the asset pipeline and not the plugin.

2
  • I want to mention that by convention third-party libraries should be placed under vendor/assets. Commented Aug 27, 2017 at 10:24
  • Thank you I have changed it now Commented Aug 27, 2017 at 14:12

1 Answer 1

3

First of all, if you have //= require_tree . in your application.js you don't need to change any other files. //= require_tree . will include all files in the javascript directory for you: http://guides.rubyonrails.org/asset_pipeline.html#manifest-files-and-directives

But the problem you have faced, I guess is a just a typo: chaffle / chaffel. But again, just clear all mentions of it and leave only require_tree – that should be enough.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.