Skip to content

chrisvfritz/rails-javascript-integrations

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webpack + Vue

This version uses Webpack to create a completely isolated frontend that overrides rake assets:precompile. It provides everything you could possibly want in your development workflow.

Setup

About 2 hours using vue-cli with the vuejs-templates/webpack template.

Usage

Assuming you have foreman installed (gem install foreman), use the development Procfile to launch Rails and Webpack together:

foreman start -f Procfile.dev

Then visit localhost:5000 to see your frontend in action.

Pros

  • Only 1 pipeline: Sprockets is now completely out of the picture, as are any of Rails' other view-related features
  • CSS preprocessors & extraction: SCSS (or other preprocessors) plus PostCSS for autoprefixing and other transforms, all extracted into a single CSS file
  • Automatic spritesheet generation: Images and other files can also be referenced via the module system and smaller images with be base64 encoded and bundled directly into HTML, JavaScript, or CSS
  • Lint-on-save: Catch errors and style violations before they catch you
  • Unit & E2E tests: Unit tests for every component and E2E tests in multiple browsers
  • Primed for mobile: Since the frontend is already independent of the backend, porting it to mobile with Cordova could be relatively trivial
  • Extremely extensible: The Webpack ecosystem is very rich, so it's likely anything else you might want to do with your builds is possible

Cons

  • Very, very complex setup: Setting all of this up by hand would probably take several days and maintaining it will require some knowledge of Webpack
  • Not progressive: The entire frontend is now a SPA, so familiarity with Rails will not help designers or backend developers build simple pages

About

Progressive integration strategies for JavaScript-heavy Rails apps

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published