Skip to content

Instantly share code, notes, and snippets.

@ryanflorence
Created October 2, 2014 18:09
Show Gist options
  • Save ryanflorence/ab8a5cde6e42c10c1ebb to your computer and use it in GitHub Desktop.
Save ryanflorence/ab8a5cde6e42c10c1ebb to your computer and use it in GitHub Desktop.

New Javascript Structure

└── app
    └── javascripts
         ├── bower_components
         ├── bundles
         │   └── <bundle-name>
         │       └── tests
         ├── external-apps
         ├── legacy
         │   └── tests
         └── shared
             ├── tests
             └── POTENTIALS.md

public/javascripts

public/javascripts becomes just a build target.

Compiled Stuff

Allow file extension to determine how to compile (sorta like asset pipeline does) and move the existing stuff into this directory.

  • .coffee
  • .jsx
  • .hbs

Source and Target:

app/javascripts/[name].coffee ->  public/javascripts/[name].js
app/javascripts/[name].hbs    ->  public/javascripts/[name].js
app/javascripts/[name].js     ->  public/javascripts/[name].js
app/javascripts/[name].jsx    ->  public/javascripts/[name].js

Eventually we'd like to get some ES6 transpiling going on and ditch coffeescript.

legacy

Move existing public/javascripts/ into legacy since its all cluttered and makes it hard to detect general abstractions from specific features. Including public/javascripts/vendor.

bundles

  • use bundles directory to develop specific features (like inbox, or files, etc.)
  • keep your own files and abstractions there.
  • If you think you've built something generic, list it in POTENTIALS.md so others can try to use it. If it turns out to be general purpose, the second person to use it will move it to shared.

external-apps

Think of these like rails engines or gems.

external-apps is an experiement. Ahmad has built an app outside of canvas (quiz statistics) but worked into the build the ability to plug it into canvas, and even share assets, including stuff like jQuery and our SASS variables.

Tests

  • tests will run by bundle, instead of everything altogether
  • tests will live IN the bundle, making relative requires super easy, and increase conciousness that you don't have any tests
  • shared tests will all run together
  • legacy tests will all run together

Assets from Gems and vendor/plugins

I have no idea. Jacob does.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment