Skip to content

chrisvfritz/rails-javascript-integrations

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Pure Sprockets with jQuery

This version uses nothing but the Rails asset pipeline, plain ES5 JavaScript, and the jQuery that ships with Rails.

Usage

Just launch Rails normally:

rails server

Pros

  • Zero setup: just create a new JS file and get minification and gzipping out of the box
  • Plain ES5: no Babel or CoffeeScript required, though CoffeeScript support also comes out of the box
  • Progressive: The parts of the app that have to be smart are, but everything else is just regular HTML
  • Scoped: all classes begin with js-, so that both developers and designers can happily add and remove classes without accidentally stepping on each other's toes
  • jQuery UJS: Rails' builtin jQuery UJS automatically sends the authenticity token in the header of jQuery's web requests

Cons

  • Too imperative: jQuery-style programming is inherently imperative, which doesn't work well with the more functional reactivity model that makes UIs easy to think about
  • Componentization is hard: The patterns to manage state, declarative rendering, events, actions, etc all require discipline and experience
  • Lots of boilerplate: A lot of extra classes and extra code, which would require reinventing a framework to DRY up
  • Ugly HTML: No HTML syntax highlighting and it must be built using clunky string concatenation

About

Progressive integration strategies for JavaScript-heavy Rails apps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published