View ember-surge-deploy.md

To deploy an ember-cli application all you have to do is build the project (npm run build) and place the contents of the dist folder on a web server. You could of course do this yourself with a webhost and SFTP but that's slow. Here's how you can use surge instead.

How to deploy ember with surge

Make sure surge.sh is installed: yarn global add surge. Also see https://surge.sh/help/getting-started-with-surge. You'll need a free account.

  1. Add "deploy": "ember build --environment=production; mv dist/index.html dist/200.html; surge dist" to your npm scripts in package.json
  2. npm run deploy

If you want a specific url, change the script ala ... surge dist my-domain.surge.sh.

View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
appName: 'Ember Twiddle'
});
View gulpfile.js
/* global require */
var gulp = require('gulp');
var critical = require('critical').stream;
/**
* GULP CRITICAL
* Extracts the necessary CSS to render the specified viewport and inlines it in the header and loads the rest of the CSS async
*/
gulp.task('critical', function () {
return gulp.src('dist/index.html')
View excludes.txt
node_modules
tmp
dist
bower_components
.tmp
View controllers.application.js
import Ember from 'ember';
export default Ember.Controller.extend({
/*openModal: function(modal, opts) {
this.controllerFor(modal).set('model', opts);
return this.render(modal, {
into: 'application',
outlet: 'modal'
});
},
View ember-fastboot-now-sh-deploy.md

Here's how you can get server-side rendering with Ember + FastBoot and deploy it with now.sh.

It requires an ember-cli application that doesn't fail when you run ember fastboot --serve-assets. Also that you have now.sh installed.

How to deploy ember with fastboot using now.sh

  1. ember install ember-cli-fastboot
  2. Add a server.js (example)
  3. ember build -p
  4. cp server.js dist/server.js
View gist:6d6e2ae8ffb99ba6a4446eae64bf57aa
import TweenLite from 'gsap/src/uncompressed/TweenLite';
require('gsap/src/uncompressed/plugins/ScrollToPlugin');
TweenLite.to(window, 1, {scrollTo: {y: 0}, ease: Power2.easeOut});
View click-outside.js
$.fn.clickOutside = function(callback) {
return this.each(function() {
var self = this;
$(document).on('click', function(event) {
if (!$(event.target).closest(self).length) {
callback.call(self, event);
}
});
});