Use production version of Ember in production build. Closes #25

This commit is contained in:
Szymon Nowak 2014-03-02 20:23:05 +01:00
parent 290d6ef845
commit e0263ab970
6 changed files with 53 additions and 15 deletions

View File

@ -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',

View File

@ -28,20 +28,26 @@
</head>
<body>
<!-- build:js(app) /scripts/vendor.js -->
<script src="/scripts/vendor/peer.js"></script>
<script src="/scripts/vendor/socket.io/socket.io.js"></script>
<!-- @if dist=false -->
<script src="/scripts/vendor/jquery-2.0.3.js"></script>
<script src="/scripts/vendor/ba-tiny-pubsub.js"></script>
<script src="/scripts/vendor/handlebars-1.2.1.js"></script>
<script src="/scripts/vendor/ember-1.4.0.js"></script>
<!-- endbuild -->
<!-- @endif -->
<!-- @if dist=true -->
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/handlebars.js/1.2.1/handlebars.runtime.min.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/ember.js/1.4.0/ember.min.js"></script>
<!-- @endif -->
<script src="https://login.persona.org/include.js"></script>
<script src="//netdna.bootstrapcdn.com/bootstrap/3.0.3/js/bootstrap.min.js"></script>
<!-- build:js(app) /scripts/vendor.js -->
<script src="/scripts/vendor/peer.js"></script>
<script src="/scripts/vendor/socket.io/socket.io.js"></script>
<script src="/scripts/vendor/ba-tiny-pubsub.js"></script>
<!-- endbuild -->
<!-- build:js({.tmp,app}) /scripts/app.js -->
<script src="/scripts/app.js"></script>
<script src="/scripts/app/lib/room.js"></script>

View File

@ -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',

View File

@ -4,7 +4,13 @@
</div>
<div class="media-body">
<p>{{yield}}</p>
<button type="button" class="btn btn-default btn-xs" {{action "cancel"}}>{{cancel-button-label}}</button>
<button type="button" class="btn btn-default btn-xs" {{action "confirm"}}>{{confirm-button-label}}</button>
{{#if cancel-button-label}}
<button type="button" class="btn btn-default btn-xs" {{action "cancel"}}>{{cancel-button-label}}</button>
{{/if}}
{{#if confirm-button-label}}
<button type="button" class="btn btn-default btn-xs" {{action "confirm"}}>{{confirm-button-label}}</button>
{{/if}}
</div>
</div>

View File

@ -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) {

View File

@ -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"