Skip to content

Instantly share code, notes, and snippets.

@jaysoo
Last active August 29, 2015 14:21
Show Gist options
  • Save jaysoo/25e4277f65db12d83c5b to your computer and use it in GitHub Desktop.
Save jaysoo/25e4277f65db12d83c5b to your computer and use it in GitHub Desktop.

This is a proposal to simplify our frontend workflow.

Current setup

  1. Work on JS source code in client/ folder.
  2. Run gulp watch, which will:
  • Compile Angular and Handlebars templates.
  • Copy client/**/* to public/client/app/, so source + compiled templates can be served through Rails.
  1. No-pipe sets client/app as the baseUrl for RequireJS.
  2. Third-party components are installed to public/client/bower_components/ (see bower.json).
  • When a new component is installed via bower, add new entry to the application's require.config.js.
    require.config({
      ember: '../bower_components/ember' // The relative path from client/app as per no-pipe
    });

Production mode

  1. Run gulp release, which concatenates, uglifies JS source, and writes them to public/client-built/app.
  2. No-pipe is configured to serve from client-built/app instead of client/app (when RAILS_ENV=production).

Proposed setup

  1. Work on JS source code in client/ folder.
  2. Run gulp watch to compile Angular and Handlebars templates.
  3. Mount the client/ folder as a public folder instead.
  4. No-pipe sets client as the baseUrl for RequireJS.
  5. Install third-party components to client/bower_components.
  • When new component is installed, add new entry to the application's require.config.js.
    require.config({
      ember: 'bower_components/ember'
    });

Production mode

  1. Run gulp release, which concatenates, uglifies JS source, and writes them to public/client.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment