1. 9
  1.  

  2. 3

    It also shows that you don’t always need a gem to do the work for you.

    This resonates, but is difficult to teach in a pithy manner I find. Sometimes it’s worth pulling in an external library, sometimes not.

    1. 4

      Definitely agree. Writing code that is mostly for “plumbing” purposes is never easy to teach because it doesn’t really stay in the mindspace for too long. Another downside is that absolutely every team member has to know the internals of this code. Although I often find this to be an upside as well ;)

    2. 1

      Another option might be to make use of custom web components that are built using Svelte, which could alleviate the need for any view helpers and is fairly well supported on modern browsers and needs just minimal adjustments to the webpack config and the use of the <svelte:options tag="custom-component-name" /> in components.

      I take this a bit further and don’t like to have every Svelte component I make to be exposed as a web component so I have two Svelte compiler directives in my config, one for files with the .webcomponent.svelte extension which has the customElement compiler option set, and one for all other .svelte files (I haven’t done this in rails/webpack but it’s relatively easy with rollup so I’d hope webpack is the same).