James,

> I'd love it if we could have a full fledged SPA using only rails
> views/templates/logic.


You can! Best of all, without any APIs and with all the goodies of React.
Here's a bit of self promotion:
https://github.com/jho406/Breezy

It also works like Turbolinks for easy SPA functionality. While Turbolinks
requests the next page’s HTML and does a <body> replacement, Breezy
requests the next page’s props (written using jbuilder-like syntax) and
does a replacement in your redux state. No APIs needed, since, like
Turbolinks, just reuses your routes.

Here's a small visual of the end product

views/
  posts/
    index.js.props
    index.jsx
    show.js.props
    show.jsx

Breezy delegates the responsibility of markup to React and the
responsibility of content (index.js.props) to Rails.

You can do a lot of things like fragment deferment, fragment fetching,
preload multiple pages in a single request, instaclick-ing. There also room
for custom reducers when you need to do something more complicated.



On Wed, May 1, 2019 at 1:43 PM James Robey <james.ro...@gmail.com> wrote:

> Most frontend tooling has a build step now, the build step depends on
> node/npm.   It's much cleaner to separate the javascript/css out from
> sprockets and use webpacker instead.  For example, you'd need this for
> css frameworks like tailwindcss that have a build step to generate
> only the css you need.
>
> I'd disagree that "most" developers are making the mistake of
> installing node as root.  Even homebrew doesn't do that.
>
> I agree there is tension due to the duplication of HTML generation on
> server side vs front-end side.  It's unfortunate.  I'd love it if we
> could have a full fledged SPA using only rails views/templates/logic.
> Otherwise it's forcing us to relegate rails to just an API, and do SSR
> in node instead.
>
> On Wed, May 1, 2019 at 6:33 AM Dominic Son <dominic...@gmail.com> wrote:
> >
> > Rails has always been about best practices in web development, not
> what's popular. If this were the case, why didn't rSpec make it as the
> default test suite in Rails 2?
> >
> > Unfortunately now, Rails 6 will contain bloat. But more concerning,
> leave most web developers vulnerable, as most will unknowingly install Node
> with sudo, making node_modules owned by root, allowing for some fun
> executions..
> >
> > For a moment, Sprockets allowed us to align our Javascript with our MVC
> resources, it was maintainable, good design, that put Rails developers on
> the same page. But starting with Rails 6, we will divide - some into
> Angular, some into React, or Vue, or any of these other exotic front end
> frameworks that repeat yourself in generating HTML.
> >
> > I guess we never really cared about being efficient. It turns out all we
> cared about was job security.
> >
> > - Dominic
> > https://linkedin.com/in/dominicson
> > http://twitter.com/deezzer
> >
> > --
> > You received this message because you are subscribed to the Google
> Groups "Ruby on Rails: Core" group.
> > To unsubscribe from this group and stop receiving emails from it, send
> an email to rubyonrails-core+unsubscr...@googlegroups.com.
> > To post to this group, send email to rubyonrails-core@googlegroups.com.
> > Visit this group at https://groups.google.com/group/rubyonrails-core.
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Core" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to rubyonrails-core+unsubscr...@googlegroups.com.
> To post to this group, send email to rubyonrails-core@googlegroups.com.
> Visit this group at https://groups.google.com/group/rubyonrails-core.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to rubyonrails-core+unsubscr...@googlegroups.com.
To post to this group, send email to rubyonrails-core@googlegroups.com.
Visit this group at https://groups.google.com/group/rubyonrails-core.
For more options, visit https://groups.google.com/d/optout.

Reply via email to