Skip to content

Webpacker compatible cocoon code without jQuery dependency

License

Notifications You must be signed in to change notification settings

dabroz/cocoon-js-vanilla

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

31 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cocoon-js-vanilla

Contains the Javascript dependency for the cocoon rubygem without jQuery dependency.

Why

After two days of fighting with cocoon:after-insert not firing, I've decided to do the sane thing and re-write Cocoon JS to vanilla JS without jQuery.

How to use

  • Install the cocoon rubygem as usual
  • yarn add cocoon-js-vanilla
  • In a JS file that relies on the cocoon javascript, import cocoon-js-vanilla at the top of the file

For example, if you're using webpacker and have an application.js entrypoint, you can do:

// app/javascript/packs/application.js
import "cocoon-js-vanilla";
...

Inspired by https://github.com/joerodrig/cocoon-js

About

Webpacker compatible cocoon code without jQuery dependency

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published