Skip to content

Instantly share code, notes, and snippets.

@Genkilabs
Last active August 29, 2015 14:07
Show Gist options
  • Save Genkilabs/fee7ca662c39a6b32aec to your computer and use it in GitHub Desktop.
Save Genkilabs/fee7ca662c39a6b32aec to your computer and use it in GitHub Desktop.
Localhost developing in Coalesce for Ember CLI based apps
#!/bin/bash
cd ../../coalesce;
npm run-script build;
cd ../coalesce-ember;
# Hack to use the latest version of Coalesce
cp ../coalesce/dist/* bower_components/coalesce/
npm run-script build;
cd ../ember-cli-coalesce-todos/client;
mkdir -p vendor/coalesce-ember
cp -R ../../coalesce-ember/dist/* vendor/coalesce-ember;
ember build;

Developing in Coalesce on Ember CLI

For ease of local development, connect Coalesce to your test app through coalesce-ember by copying built dist dirs directly to the bower_components/vendor directory. This will allow for changes to be built immediately without the need to publish to Bower. We will also add a build script to one-line all the steps of the build process.

Setup

1 Coalesce

  • Clone coalesce git clone git@github.com:coalescejs/coalesce.git

  • Run the dependency installs npm install

  • Test that you can build a distributable npm run-script build

2 Coalesce Ember

  • Clone coalesce-ember git clone git@github.com:coalescejs/coalesce-ember.git

  • Remove the bower version of coalesce from the bower.json file and dir if it is there bower uninstall --save coalesce

  • Run the dependency installs npm install

  • Make a direcoty in bower_components (since we removed it from our dependencies) that will hold a copy of the coalesce source we built locally. mkdir bower_components/coalesce-ember

3 Your Test App

For whatever reason, adding simlinks to the bower_components directory will often throw file-not-found type errors. To work around this we will just copy the build coalesce-ember/dist directory into our test app's vendor directory. We will include this in our final build script.

  • Generate your testbench Ember CLI app, or use an existing app. If you have already installed coalesce-ember, remove it bower uninstall --save coalesce-ember

  • Make a direcoty in vendor that will hold a copy of the source we built locally. mkdir vendor/coalesce-ember

  • Add the dependency to your Brocfile.js app.import('vendor/coalesce-ember/src/main.js');

  • Include our build script in the package.json file

     	"scripts": {
     	    "build": "./build.sh",
       }
    

Build

Build the whole thing with NPM: npm run-script build (or just run the script directly)

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