Open jarednorman opened 7 years ago
I can check this, however I was hinking about moving to ES2015 and using imports instead of Sprockets.
tried to use as node package + webpack import
import 'vanilla-ujs/lib/assets/javascripts/vanilla-ujs/polyfills.js';
import 'vanilla-ujs/lib/assets/javascripts/vanilla-ujs/confirm.js';
import 'vanilla-ujs/lib/assets/javascripts/vanilla-ujs/csrf.js';
import 'vanilla-ujs/lib/assets/javascripts/vanilla-ujs/disable.js';
import 'vanilla-ujs/lib/assets/javascripts/vanilla-ujs/form.js';
import 'vanilla-ujs/lib/assets/javascripts/vanilla-ujs/liteajax.js';
import 'vanilla-ujs/lib/assets/javascripts/vanilla-ujs/method.js';
but it does not work
it says matches as not defined
Now that rails-ujs exists with no dep on jQuery, I just use that. I'm unfollowing this issue, but not closing it since other people seem to want this feature. :heart:
I managed to use this with with webpacker using the following code:
window.matches = (function(doc) {
return doc.matchesSelector ||
doc.webkitMatchesSelector ||
doc.mozMatchesSelector ||
doc.oMatchesSelector ||
doc.msMatchesSelector;
})(document.documentElement);
import 'vanilla-ujs/lib/assets/javascripts/vanilla-ujs/polyfills.js';
import 'vanilla-ujs/lib/assets/javascripts/vanilla-ujs/confirm.js';
import 'vanilla-ujs/lib/assets/javascripts/vanilla-ujs/csrf.js';
import 'vanilla-ujs/lib/assets/javascripts/vanilla-ujs/disable.js';
import 'vanilla-ujs/lib/assets/javascripts/vanilla-ujs/form.js';
import 'vanilla-ujs/lib/assets/javascripts/vanilla-ujs/liteajax.js';
import 'vanilla-ujs/lib/assets/javascripts/vanilla-ujs/method.js';
UPDATE: This works for some features (confirm) but not for others (LiteAjax is not plublicly exposed...)
I'm going to take advantage of this issue and ask if there is a chance to remove railsties gem and make this gem agnostic.
Versions after
0.1.0
don't seem to be able to be (reasonably) used outside of Sprockets (within other build tools, like Webpack, for example). Currently installing this package from npm seem kind of pointless since it contains Sprockets directives that don't work outside of Sprockets.Was this a conscious decision? With Rails moving towards being friendlier to external asset tools with Webpacker and all that, it seems like this project should support that stuff. Thoughts?