ember-cli-fastboot
Advanced tools
Comparing version 0.0.1 to 0.0.2
@@ -1,2 +0,2 @@ | ||
/*globals SimpleDOM, Ember, FastBoot*/ | ||
/*globals SimpleDOM, Ember, FastBoot, URL*/ | ||
@@ -10,3 +10,9 @@ export default { | ||
var doc = new SimpleDOM.Document(); | ||
var domHelper = new Ember.View.DOMHelper(doc); | ||
domHelper.protocolForURL = function(url) { | ||
var protocol = URL.parse(url).protocol; | ||
return (protocol == null) ? ':' : protocol; | ||
}; | ||
// This needs to be setting up renderer:main, and ideally would have a less hacked | ||
@@ -17,3 +23,3 @@ // up interface. In particular, the only ACTUAL swap-in here is the fake document, | ||
create: function() { | ||
return new Ember.View._Renderer(new Ember.View.DOMHelper(doc)); | ||
return new Ember.View._Renderer(domHelper, false); | ||
} | ||
@@ -26,17 +32,6 @@ }); | ||
view._morph = { | ||
contextualElement: {}, | ||
setContent: function(element) { | ||
this.element = element; | ||
}, | ||
var element = Ember.run(view, 'createElement').element; | ||
destroy: function() { } | ||
}; | ||
Ember.run(view, function() { | ||
view.renderer.renderTree(view); | ||
}); | ||
var serializer = new SimpleDOM.HTMLSerializer(SimpleDOM.voidMap); | ||
return serializer.serialize(view._morph.element); | ||
return serializer.serialize(element); | ||
}); | ||
@@ -43,0 +38,0 @@ }); |
@@ -132,3 +132,5 @@ module.exports = { | ||
// Expose a hook for the Ember app to provide its handleURL functionality | ||
FastBoot: { resolve: deferred.resolve } | ||
FastBoot: { resolve: deferred.resolve }, | ||
URL: require("url"), | ||
}; | ||
@@ -135,0 +137,0 @@ |
{ | ||
"name": "ember-cli-fastboot", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"description": "Server-side rendering for Ember.js apps", | ||
@@ -39,4 +39,4 @@ "directories": { | ||
"rsvp": "^3.0.16", | ||
"simple-dom": "^0.1.3" | ||
"simple-dom": "0.2.1" | ||
} | ||
} |
@@ -22,2 +22,65 @@ # Ember FastBoot | ||
In order to get FastBoot working, you will first need to do the | ||
following: | ||
* Disable Ember CLI's default configuration meta tag | ||
* Install Ember Canary and enable HTMLbars | ||
* Enable the required feature flags | ||
#### Disable Default Configuration | ||
Modify your application's generated `Brocfile` to disable storing | ||
configuration information in a `<meta>` tag: | ||
```js | ||
// Brocfile.js | ||
var app = new EmberApp({ | ||
storeConfigInMeta: false | ||
}); | ||
``` | ||
#### Install Ember Canary and Enable HTMLbars | ||
To enable Ember canary and HTMLbars, run the following commands: | ||
``` | ||
rm -rf bower_components | ||
bower install --save handlebars#~2.0.0 | ||
bower install --save ember#canary | ||
bower install | ||
``` | ||
Bower also prompts you to confirm various "resolutions" that it is | ||
unsure of. Make sure you pick ember#canary and Handlebars 2.0 if | ||
prompted. | ||
Then update the npm dependencies: | ||
``` | ||
npm uninstall --save-dev broccoli-ember-hbs-template-compiler | ||
npm install --save-dev ember-cli-htmlbars | ||
``` | ||
For more details, [see this blog | ||
post](http://reefpoints.dockyard.com/2014/11/30/htmlbars_calling_all_testers.html). | ||
#### Enable Required Feature Flags | ||
Lastly, enabled the following feature flags: | ||
* `ember-application-instance-initializers` | ||
* `ember-application-visit` | ||
To enable the these flags, add the following to your | ||
`config/environment.js` (under the `EmberENV.FEATURES` section): | ||
```js | ||
EmberENV: { | ||
FEATURES: { | ||
'ember-application-instance-initializers': true, | ||
'ember-application-visit': true | ||
} | ||
}, | ||
``` | ||
## Running | ||
@@ -24,0 +87,0 @@ |
22459
166
299
+ Addedsimple-dom@0.2.1(transitive)
- Removedsimple-dom@0.1.3(transitive)
Updatedsimple-dom@0.2.1