From e0263ab9708cf387142b7ace4477044527dfdb5d Mon Sep 17 00:00:00 2001 From: Szymon Nowak Date: Sun, 2 Mar 2014 20:23:05 +0100 Subject: [PATCH] Use production version of Ember in production build. Closes #25 --- Gruntfile.js | 25 +++++++++++++++++-- app/index.html | 20 +++++++++------ app/scripts/app/lib/webrtc.js | 5 +++- .../templates/components/confirm-popover.hbs | 10 ++++++-- app/server.js | 4 ++- package.json | 4 +-- 6 files changed, 53 insertions(+), 15 deletions(-) diff --git a/Gruntfile.js b/Gruntfile.js index 308eda8..2380240 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -75,11 +75,24 @@ module.exports = function (grunt) { } }, + preprocess: { + dev: { + src : 'app/index.html', + dest : '.tmp/index.html', + options: { context: { dist: false } } + }, + dist: { + src : 'app/index.html', + dest : '.tmp/index.html', + options: { context: { dist: true } } + } + }, + // Reads HTML for usemin blocks to enable smart builds that automatically // concat, minify and revision files. Creates configurations in memory so // additional tasks can operate on them useminPrepare: { - html: 'app/index.html', + html: '.tmp/index.html', options: { dest: 'dist' } @@ -101,10 +114,16 @@ module.exports = function (grunt) { cwd: 'app', dest: 'dist', src: [ - 'index.html', 'server.js', 'fonts/**/*.{eot,svg,ttf,woff}' ] + }, { + expand: true, + cwd: '.tmp', + dest: 'dist', + src: [ + 'index.html' + ] }] } }, @@ -158,6 +177,7 @@ module.exports = function (grunt) { grunt.task.run([ 'clean:dev', 'env:dev', + 'preprocess:dev', 'concurrent:dev', 'server:dev', 'watch' @@ -166,6 +186,7 @@ module.exports = function (grunt) { grunt.registerTask('build', [ 'clean:dist', + 'preprocess:dist', 'useminPrepare', 'concurrent:dist', 'concat', diff --git a/app/index.html b/app/index.html index 51af293..3c45f6e 100644 --- a/app/index.html +++ b/app/index.html @@ -28,20 +28,26 @@ - - - - + - - - + + + + + + + + + + + + diff --git a/app/scripts/app/lib/webrtc.js b/app/scripts/app/lib/webrtc.js index 5965ab2..dc9d384 100644 --- a/app/scripts/app/lib/webrtc.js +++ b/app/scripts/app/lib/webrtc.js @@ -1,5 +1,8 @@ -// TODO: provide TURN server config +window.requestFileSystem = window.requestFileSystem || window.webkitRequestFileSystem; +window.URL = window.URL || window.webkitURL; +// TODO: provide TURN server config +// once it's possible to create rooms with custom names. FileDrop.WebRTC = function (options) { this.conn = new Peer({ // PeerJS client library host: 'file-drop-peer-server.herokuapp.com', diff --git a/app/scripts/app/templates/components/confirm-popover.hbs b/app/scripts/app/templates/components/confirm-popover.hbs index 0e6955e..2b880e1 100644 --- a/app/scripts/app/templates/components/confirm-popover.hbs +++ b/app/scripts/app/templates/components/confirm-popover.hbs @@ -4,7 +4,13 @@

{{yield}}

- - + + {{#if cancel-button-label}} + + {{/if}} + + {{#if confirm-button-label}} + + {{/if}}
diff --git a/app/server.js b/app/server.js index f23826c..882d144 100644 --- a/app/server.js +++ b/app/server.js @@ -5,6 +5,7 @@ module.exports.server = function (options) { // Room server var http = require('http'), util = require('util'), + path = require('path'), express = require('express'), uuid = require('node-uuid'), crypto = require('crypto'), @@ -42,7 +43,8 @@ module.exports.server = function (options) { persona(app, { audience: 'http://' + host + ':' + webPort }); app.get('/', function (req, res) { - res.sendfile(__dirname + '/index.html'); + var root = path.join(__dirname, '..', base[0]); + res.sendfile(root + '/index.html'); }); app.get('/room', function (req, res) { diff --git a/package.json b/package.json index 27549a6..ad2e882 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,6 @@ "express-persona": "~0.1.1", "node-uuid": "~1.4.1", "deep-extend": "~0.2.6", - "grunt": "~0.4.2", "grunt-cli": "~0.1.9", "load-grunt-tasks": "~0.2.1", @@ -29,7 +28,8 @@ "grunt-usemin": "~2.0.2", "grunt-concurrent": "~0.4.3", "grunt-contrib-compass": "~0.7.1", - "grunt-env": "~0.4.1" + "grunt-env": "~0.4.1", + "grunt-preprocess": "^4.0.0" }, "engines": { "node": "~0.10.0"