• Stars
    star
    183
  • Rank 210,154 (Top 5 %)
  • Language
    Ruby
  • Created over 8 years ago
  • Updated about 7 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Progressive integration strategies for JavaScript-heavy Rails apps

Rails JavaScript Integration Strategies

NOTE: This is more up-to-date than the last commit date would indicate, as most of the interesting work is not on the master branch.

Why this?

Componentized views make UI development orders of magnitude simpler. Unfortunately, scaling UI development and integrating a modern JavaScript workflow into a new or existing Rails app can be tricky.

What is this?

This project builds a simple todo list component with 4 different JavaScript integration strategies:

  • scoped-jquery: I wouldn't actually recommend this for anyone. But, if your team is currently using jQuery and adopting a new framework is a tough sell right now, here's a relatively simple pattern that may help.
  • vue-simple: A fantastic strategy for existing projects, as Vue plays well with jQuery and other DOM-manipulating libraries. This integration strategy also requires less than 1 minute of setup! As for learning curve, becoming very productive in Vue takes less than a day.
  • vue-browserify: Recommended strategy for most new projects. It takes about a half hour to set up, offers a UMD module system, very nice workflow with hot module reloading, and best of all - the configuration is simple enough that it's actually possible for mere mortals to understand everything that's happening!
  • vue-webpack: Recommended for people who want to be on the cutting edge and are willing to dive into the guts of build tools. It offers the best possible workflow and tooling possible for any framework at the time of writing.

How do I use this?

There are two recommended ways of browsing this project. The first is to read the diffs between branches in order of rising complexity. The current branch (master) is just a newly generated Rails app.

  1. master..scoped-jquery: Adds the todo model and API, with a single JavaScript file.
  2. scoped-jquery..vue-simple: Converts the scoped jQuery to a much simpler Vue component.
  3. vue-simple..vue-browserify: Moves all JavaScript to a new frontend folder managed by Browserify. Components are also organized into more advanced components in .vue files.
  4. vue-browserify..vue-webpack: Bypasses sprockets and all view-related Rails features, now managing the entire UI in the frontend folder through Webpack.

If there's a specific setup you're interested in and you want to see all work done from the point of a newly generated Rails app, just diff with master:

Contributing

If you notice a mistake, room for improvement, or have questions, issues and pull requests are very welcome. 😄

More Repositories

1

prerender-spa-plugin

Prerenders static HTML in a single-page application.
JavaScript
7,323
star
2

vue-2.0-simple-routing-example

A simple example of routing with Vue 2.0 without using vue-router.
Vue
1,653
star
3

7-secret-patterns

586
star
4

hello-vue-components

An example component library built with Vue CLI 3.
JavaScript
316
star
5

vue-ssr-demo-simple

Simplest possible Vue 2.0 SSR demo
JavaScript
151
star
6

isabella

A voice-computing assistant built in Ruby.
Ruby
139
star
7

vue-monolith-example

Simple example of how to structure a monolithic Vue application
JavaScript
129
star
8

vue-render-performance-comparisons

Very simple project to benchmark Vue's render performance in comparison to other libraries
JavaScript
123
star
9

language_filter

LanguageFilter is a Ruby gem to detect and optionally filter multiple categories of language.
Ruby
91
star
10

vuepress-enhanced-examples

This is an attempt at providing a better experience for documentation authors and consumers, in regards to examples.
Vue
58
star
11

vue-3-trends

43
star
12

prerender-spa-plugin-vue-demo

JavaScript
31
star
13

vue-workshop

JavaScript
27
star
14

vue-migration-helper

20
star
15

pnglink

pnglink allows dynamic content, created by libraries like D3.js, to be downloaded as a PNG snapshot with a single click.
JavaScript
17
star
16

node-web-server-demos

Simple Node web server demos
9
star
17

vue-enterprise-slides

7
star
18

vue-protyping-boilerplate

Vue
5
star
19

cat_api

Ruby
3
star
20

view-framework-demos

HTML
3
star
21

tc359_cheatsheets

Cheatsheets for common tasks and difficult concepts.
2
star
22

-

2
star
23

better-world-wallet-web

Prototype for a better way of handling donations (first for YouTube artists), then for the WOOORLD!
CoffeeScript
2
star
24

tc359_syllabus

1
star
25

maintainable-webpack-config

JavaScript
1
star
26

simple_cat_app

CSS
1
star
27

codekwondo

Ruby
1
star
28

heroku-buildpack-nodejs-chn-link

Shell
1
star