...functions with the right HTML elements. Some common ways to do this are: Our compiler() helper Unpoly compilers Custom Elements MutationObserver AngularJS directives React components We recommend using the compiler...
Count items Now make a component for the container instead of the button: compiler('.countable', function(countable) { const button = ... const items = ... button.addEventListener('click', ...) }) Spoilers Add an optional "plot summary...
...menu items of your MovieDB. Integrate Feather for this. You might need such a compiler to "activate" the icons: import feather from 'feather-icons' up.compiler('[data-feather]', feather.replace...
...to add lodash to MovieDB Use yarn add lodash, then import it in your compiler e.g. like this: import debounce from 'lodash/debounce' Can you find a way to make use...
...also the shortcut element.click(). Loading elements after a delay Use custom elements or Unpoly compilers to build a element. It should afford an API like this: This will load soon...
Has no separate build process in development. Instead the Rails server directly compiles the asset whenever it renders a javascript_tag, stylesheet_tag or image_tag.
The asset pipeline is one of Rails' two mechanisms how stylesheets, javascripts and images from your /assets folder are processed...
Best results in other decks
The attached compiler() function below applies JavaScript behavior to matching HTML elements as they enter the DOM. This works like an Unpoly compiler for apps that don't use Unpoly...
...Custom Elements or any other mechanism that pairs JavaScript with HTML elements. The compiler() function is also a lightweight replacement for our legacy $.unobtrusive() helper (no jQuery required).
Usually, Unpoly compiler destructors are returned from the compiler function. However, when using async compiler functions, you can not register destructors via return. This will not work: up.compiler('my-example...