mirror of
https://gitlab.silvrtree.co.uk/martind2000/censis-archive.git
synced 2025-01-11 06:45:08 +00:00
”2016-07-28”
This commit is contained in:
parent
32f042bb41
commit
1dc6d36fca
@ -56,7 +56,7 @@ if (process.env.NODE_ENV === 'production') {
|
||||
isProduction = true;
|
||||
}
|
||||
|
||||
logger.debug('isProduction:', isProduction);
|
||||
logger.warn('isProduction:', isProduction);
|
||||
|
||||
var app = express();
|
||||
|
||||
|
@ -5,13 +5,13 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Console</title>
|
||||
<!-- build:fonts -->
|
||||
<!-- <link rel="stylesheet"
|
||||
<link rel="stylesheet"
|
||||
href="http://fonts.googleapis.com/css?family=Ubuntu:300,400,500,700"
|
||||
type="text/css">
|
||||
<link href='https://fonts.googleapis.com/css?family=Ubuntu+Condensed'
|
||||
rel='stylesheet' type='text/css'>
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
|
||||
rel="stylesheet">-->
|
||||
rel="stylesheet">
|
||||
<!-- endbuild -->
|
||||
<!-- build:css -->
|
||||
<link href="css/mui.css" rel="stylesheet" type="text/css"/>
|
||||
@ -151,12 +151,12 @@
|
||||
<div class="mui-col-xs-4 mui--text-center" id="auxFront"
|
||||
style="display:none;">
|
||||
<div>
|
||||
<button class="mui-btn mui-btn--small mui-btn--accent turnUp"
|
||||
<button class="mui-btn mui-btn--small mui-btn--accent lightUp"
|
||||
id="frontUp">BRIGHTER
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="mui-btn mui-btn--small mui-btn--accent turnDown"
|
||||
<button class="mui-btn mui-btn--small mui-btn--accent lightDown"
|
||||
id="frontDown">DARKER
|
||||
</button>
|
||||
</div>
|
||||
@ -205,12 +205,12 @@
|
||||
<div class="mui-col-xs-4 mui--text-center" id="auxBack"
|
||||
style="display: none;">
|
||||
<div>
|
||||
<button class="mui-btn mui-btn--small mui-btn--accent turnUp"
|
||||
<button class="mui-btn mui-btn--small mui-btn--accent lightUp"
|
||||
id="backUp">BRIGHTER
|
||||
</button>
|
||||
</div>
|
||||
<div>
|
||||
<button class="mui-btn mui-btn--small mui-btn--accent turnDown"
|
||||
<button class="mui-btn mui-btn--small mui-btn--accent lightDown"
|
||||
id="backDown">DARKER
|
||||
</button>
|
||||
</div>
|
||||
@ -311,6 +311,7 @@
|
||||
<script src="js/parts/clock.js"></script>
|
||||
<script src="js/parts/meetings.js"></script>
|
||||
<script src="js/parts/lights.js"></script>
|
||||
<script src="js/parts/projector.js"></script>
|
||||
<script src="js/appv3.js"></script>
|
||||
</body>
|
||||
<!-- endbuild -->
|
||||
|
@ -105,6 +105,7 @@ var SOController = (function() {
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
function lightCommand(id) {
|
||||
console.log('lightCommand',path + 'api/v1/lighting/cmd');
|
||||
$.post(path + 'api/v1/lighting/cmd', {id: id}, function() {});
|
||||
@ -118,6 +119,7 @@ var SOController = (function() {
|
||||
function turnOffLights(id) {
|
||||
$.post(path + 'api/v1/lighting/off', {light: id}, function() {});
|
||||
}
|
||||
*/
|
||||
|
||||
function turnOnHeating() {
|
||||
$.post(path + 'api/v1/heating/on', {}, function() {});
|
||||
@ -147,6 +149,7 @@ var SOController = (function() {
|
||||
}
|
||||
|
||||
function attachClicks() {
|
||||
/*
|
||||
$('#projectorOn').on('click', function() {
|
||||
turnOnProjector();
|
||||
});
|
||||
@ -154,6 +157,7 @@ var SOController = (function() {
|
||||
$('#projectorOff').on('click', function() {
|
||||
turnOffProjector();
|
||||
});
|
||||
*/
|
||||
|
||||
$('#heatingOn').on('click', function() {
|
||||
turnOnHeating();
|
||||
@ -163,33 +167,6 @@ var SOController = (function() {
|
||||
turnOffHeating();
|
||||
});
|
||||
|
||||
$('#frontLightOn').on('click', function() {
|
||||
// 1 for board lights
|
||||
turnOnLights('o');
|
||||
});
|
||||
|
||||
$('#middleLightOn').on('click', function() {
|
||||
turnOnLights(2);
|
||||
});
|
||||
|
||||
$('#backLightOn').on('click', function() {
|
||||
// 3 for board lights
|
||||
turnOnLights('n');
|
||||
});
|
||||
|
||||
$('#frontLightOff').on('click', function() {
|
||||
// A for board lights
|
||||
turnOffLights('f');
|
||||
});
|
||||
|
||||
$('#middleLightOff').on('click', function() {
|
||||
turnOffLights('b');
|
||||
});
|
||||
|
||||
$('#backLightOff').on('click', function() {
|
||||
turnOffLights('g');
|
||||
});
|
||||
|
||||
|
||||
$('#extend05').on('click', function() {
|
||||
extendMeetingBy(5);
|
||||
@ -207,33 +184,6 @@ var SOController = (function() {
|
||||
extendMeetingBy(30);
|
||||
});
|
||||
|
||||
$('#frontUp').on('click', function(event) {
|
||||
var target = $(event.target);
|
||||
|
||||
lightCommand('9');
|
||||
delayButton(target);
|
||||
});
|
||||
|
||||
$('#frontDown').on('click', function(event) {
|
||||
var target = $(event.target);
|
||||
lightCommand('1');
|
||||
delayButton(target);
|
||||
});
|
||||
|
||||
$('#backUp').on('click', function(event) {
|
||||
var target = $(event.target);
|
||||
|
||||
lightCommand('8');
|
||||
delayButton(target);
|
||||
});
|
||||
|
||||
$('#backDown').on('click', function(event) {
|
||||
var target = $(event.target);
|
||||
|
||||
lightCommand('2');
|
||||
delayButton(target);
|
||||
});
|
||||
|
||||
|
||||
$('#projectorHDMI').on('click', function(event) {
|
||||
var target = $(event.target);
|
||||
@ -339,7 +289,8 @@ var SOController = (function() {
|
||||
this.backLightData = new LightModel({device: 'back',on: 'n',off: 'g', up: '8', down: '2'});
|
||||
this.backLight = new Light({el: $('#back-light'),model: this.backLightData});
|
||||
|
||||
|
||||
this.projectorData = new ProjectorModel({device: 'projector', up: '8', down: '2'});
|
||||
this.projector = new Projector({el: $('#projector-panel'),model: this.projectorData});
|
||||
|
||||
this.addLight(this.frontLightData);
|
||||
this.addLight(this.backLightData);
|
||||
|
@ -8,39 +8,41 @@
|
||||
*/
|
||||
var path = 'http://localhost:3000/';
|
||||
var LightModel = Backbone.Model.extend({
|
||||
//$.post(path + 'api/v1/lighting/on', {light: id}, function() {});
|
||||
urlRoot: path + 'api/v1/lighting/',
|
||||
initialize: function() {
|
||||
this.set('status',false);
|
||||
this.set('enabled',true);
|
||||
},
|
||||
turnOn: function() {
|
||||
console.log('LightModel:TurnOn');
|
||||
this.set('id','on');
|
||||
this.save({light: this.get('on')},{
|
||||
type: 'POST'
|
||||
});
|
||||
},
|
||||
turnOff: function() {
|
||||
console.log('LightModel:TurnOff');
|
||||
this.set('id','off');
|
||||
this.save({light: this.get('off')},{
|
||||
type: 'POST'
|
||||
});
|
||||
},
|
||||
turnUp: function() {
|
||||
console.log('LightModel:TurnOff');
|
||||
this.set('id','cmd');
|
||||
this.save({light: this.get('up')},{
|
||||
type: 'POST'
|
||||
});
|
||||
},
|
||||
turnDown: function() {
|
||||
console.log('LightModel:TurnDown');
|
||||
this.set('id','cmd');
|
||||
this.save({light: this.get('down')},{
|
||||
type: 'POST'
|
||||
});
|
||||
|
||||
},
|
||||
disable: function() {
|
||||
this.set('enabled',false);
|
||||
},
|
||||
enable: function() {
|
||||
this.set('enabled',true);
|
||||
}
|
||||
});
|
||||
|
||||
@ -49,24 +51,35 @@ var Light = Backbone.View.extend({
|
||||
events: {
|
||||
'click .lightOn': 'turnOn',
|
||||
'click .lightOff': 'turnOff',
|
||||
'click .lightPp': 'turnup'
|
||||
'click .lightUp': 'turnUp',
|
||||
'click .lightDown': 'turnDown'
|
||||
},
|
||||
initialize: function() {
|
||||
var tStr;
|
||||
_.bindAll(this, 'render', 'update', 'turnOn','turnOff');
|
||||
_.bindAll(this, 'render', 'update', 'turnOn','turnOff', 'turnUp','turnDown','updateStatus','updateEnabled');
|
||||
this.model.bind('change', this.update);
|
||||
this.$onButton = $('#' + this.model.get('device') + 'LightOn');
|
||||
this.$offButton = $('#' + this.model.get('device') + 'LightOff');
|
||||
this.$onButton = this.$('#' + this.model.get('device') + 'LightOn');
|
||||
this.$offButton = this.$('#' + this.model.get('device') + 'LightOff');
|
||||
this.$upButton = this.$('#' + this.model.get('device') + 'Up');
|
||||
this.$downButton = this.$('#' + this.model.get('device') + 'Down');
|
||||
|
||||
tStr = this.model.get('device')[0].toUpperCase() + this.model.get('device').substring(1);
|
||||
|
||||
this.$aux = $('#aux' + tStr);
|
||||
this.$aux = this.$('#aux' + tStr);
|
||||
// This.render();
|
||||
},
|
||||
render: function() {
|
||||
console.log('Light:Render');
|
||||
console.log(this);
|
||||
},
|
||||
update: function() {
|
||||
if (this.model.hasChanged('status')) {
|
||||
this.updateStatus();
|
||||
}
|
||||
|
||||
if (this.model.hasChanged('enabled')) {
|
||||
this.updateEnabled();
|
||||
}
|
||||
},
|
||||
updateStatus: function() {
|
||||
if (this.model.get('status') === true) {
|
||||
// Lights are on..
|
||||
this.$onButton.hide();
|
||||
@ -78,17 +91,32 @@ var Light = Backbone.View.extend({
|
||||
this.$aux.fadeOut();
|
||||
}
|
||||
|
||||
},
|
||||
updateEnabled: function() {
|
||||
var enabled = this.model.get('enabled');
|
||||
if (enabled) {
|
||||
this.$el.removeClass('lostConnection');
|
||||
} else {
|
||||
this.$el.addClass('lostConnection');
|
||||
}
|
||||
|
||||
this.$onButton.attr('disabled', !enabled);
|
||||
this.$offButton.attr('disabled', !enabled);
|
||||
this.$upButton.attr('disabled', !enabled);
|
||||
this.$downButton.attr('disabled', !enabled);
|
||||
|
||||
},
|
||||
turnOn: function() {
|
||||
console.log('Light:On');
|
||||
this.model.turnOn();
|
||||
},
|
||||
turnOff: function() {
|
||||
console.log('Light:Off');
|
||||
this.model.turnOff();
|
||||
},
|
||||
turnUp: function() {
|
||||
console.log('Light:Up');
|
||||
this.model.turnUp();
|
||||
},
|
||||
turnDown: function() {
|
||||
this.model.turnDown();
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -1,3 +1,4 @@
|
||||
'use strict';
|
||||
/**
|
||||
*
|
||||
* User: Martin Donnelly
|
||||
@ -5,3 +6,117 @@
|
||||
* Time: 09:25
|
||||
*
|
||||
*/
|
||||
var path = 'http://localhost:3000/';
|
||||
var ProjectorModel = Backbone.Model.extend({
|
||||
urlRoot: path + 'api/v1/projector/',
|
||||
initialize: function() {
|
||||
this.set('status',false);
|
||||
this.set('enabled',true);
|
||||
},
|
||||
turnOn: function() {
|
||||
this.set('id','on');
|
||||
this.save({projector: this.get('on')},{
|
||||
type: 'POST'
|
||||
});
|
||||
},
|
||||
turnOff: function() {
|
||||
this.set('id','off');
|
||||
this.save({projector: this.get('off')},{
|
||||
type: 'POST'
|
||||
});
|
||||
},
|
||||
turnUp: function() {
|
||||
this.set('id','cmd');
|
||||
this.save({projector: this.get('up')},{
|
||||
type: 'POST'
|
||||
});
|
||||
},
|
||||
turnDown: function() {
|
||||
this.set('id','cmd');
|
||||
this.save({projector: this.get('down')},{
|
||||
type: 'POST'
|
||||
});
|
||||
|
||||
},
|
||||
disable: function() {
|
||||
this.set('enabled',false);
|
||||
},
|
||||
enable: function() {
|
||||
this.set('enabled',true);
|
||||
}
|
||||
});
|
||||
|
||||
var Projector = Backbone.View.extend({
|
||||
tagName: 'div',
|
||||
events: {
|
||||
'click .projectorOn': 'turnOn',
|
||||
'click .projectorOff': 'turnOff',
|
||||
'click .projectorUp': 'turnUp',
|
||||
'click .projectorDown': 'turnDown'
|
||||
},
|
||||
initialize: function() {
|
||||
var tStr;
|
||||
_.bindAll(this, 'render', 'update', 'turnOn','turnOff', 'updateStatus','updateEnabled');
|
||||
this.model.bind('change', this.update);
|
||||
console.log('Projector:initialize',this.model.get('device'));
|
||||
this.$onButton = this.$('#' + this.model.get('device') + 'On');
|
||||
this.$offButton = this.$('#' + this.model.get('device') + 'Off');
|
||||
|
||||
tStr = this.model.get('device')[0].toUpperCase() + this.model.get('device').substring(1);
|
||||
|
||||
this.$aux = this.$('#aux' + tStr);
|
||||
// This.render();
|
||||
},
|
||||
render: function() {
|
||||
},
|
||||
update: function() {
|
||||
console.log('Projector:update');
|
||||
if (this.model.hasChanged('status')) {
|
||||
this.updateStatus();
|
||||
}
|
||||
|
||||
if (this.model.hasChanged('enabled')) {
|
||||
this.updateEnabled();
|
||||
}
|
||||
},
|
||||
updateStatus: function() {
|
||||
if (this.model.get('status') === true) {
|
||||
// projectors are on..
|
||||
this.$onButton.hide();
|
||||
this.$offButton.show();
|
||||
this.$aux.fadeIn(500);
|
||||
} else {
|
||||
this.$onButton.show();
|
||||
this.$offButton.hide();
|
||||
this.$aux.fadeOut();
|
||||
}
|
||||
|
||||
},
|
||||
updateEnabled: function() {
|
||||
var enabled = this.model.get('enabled');
|
||||
if (enabled) {
|
||||
this.$el.removeClass('lostConnection');
|
||||
} else {
|
||||
this.$el.addClass('lostConnection');
|
||||
}
|
||||
|
||||
this.$onButton.attr('disabled', !enabled);
|
||||
this.$offButton.attr('disabled', !enabled);
|
||||
this.$upButton.attr('disabled', !enabled);
|
||||
this.$downButton.attr('disabled', !enabled);
|
||||
|
||||
},
|
||||
turnOn: function() {
|
||||
this.model.turnOn();
|
||||
},
|
||||
turnOff: function() {
|
||||
this.model.turnOff();
|
||||
},
|
||||
turnUp: function() {
|
||||
this.model.turnUp();
|
||||
},
|
||||
turnDown: function() {
|
||||
this.model.turnDown();
|
||||
}
|
||||
|
||||
});
|
||||
|
@ -93,17 +93,24 @@ var SOWEBSOCKET = function(newController) {
|
||||
$aux = $('#auxProjector');
|
||||
|
||||
if (status) {
|
||||
|
||||
controller.projectorData.set('status',true);
|
||||
/*
|
||||
$hide = $('#projectorOn');
|
||||
$show = $('#projectorOff');
|
||||
$aux.fadeIn();
|
||||
*/
|
||||
} else {
|
||||
controller.projectorData.set('status',false);
|
||||
/*
|
||||
$show = $('#projectorOn');
|
||||
$hide = $('#projectorOff');
|
||||
$aux.fadeOut();
|
||||
*/
|
||||
}
|
||||
$($show).show();
|
||||
/* $($show).show();
|
||||
$($hide).hide();
|
||||
|
||||
*/
|
||||
};
|
||||
|
||||
this.updateLighting = function(obj) {
|
||||
@ -200,20 +207,8 @@ var SOWEBSOCKET = function(newController) {
|
||||
|
||||
$('#longWait').hide();
|
||||
$('#noSocket').slideUp();
|
||||
$('#front-light').removeClass('lostConnection');
|
||||
$('#back-light').removeClass('lostConnection');
|
||||
|
||||
|
||||
$('#frontLightOn').attr('disabled', false);
|
||||
$('#frontLightOff').attr('disabled', false);
|
||||
$('#frontUp').attr('disabled', false);
|
||||
$('#frontDown').attr('disabled', false);
|
||||
|
||||
$('#backLightOn').attr('disabled', false);
|
||||
$('#backLightOff').attr('disabled', false);
|
||||
$('#backUp').attr('disabled', false);
|
||||
$('#backDown').attr('disabled', false);
|
||||
|
||||
controller.getLight(0).set('enabled',true);
|
||||
controller.getLight(1).set('enabled',true);
|
||||
var now = new Date;
|
||||
var mod = 60000 - (now.getTime() % 60000);
|
||||
|
||||
@ -273,21 +268,10 @@ var SOWEBSOCKET = function(newController) {
|
||||
|
||||
if (this.retry === 3) {
|
||||
$('#longWait:hidden').fadeIn();
|
||||
$('#front-light').addClass('lostConnection');
|
||||
$('#back-light').addClass('lostConnection');
|
||||
|
||||
$('#frontLightOn').attr('disabled', true);
|
||||
$('#frontLightOff').attr('disabled', true);
|
||||
$('#frontUp').attr('disabled', true);
|
||||
$('#frontDown').attr('disabled', true);
|
||||
|
||||
$('#backLightOn').attr('disabled', true);
|
||||
$('#backLightOff').attr('disabled', true);
|
||||
$('#backUp').attr('disabled', true);
|
||||
$('#backDown').attr('disabled', true);
|
||||
|
||||
//LostConnection
|
||||
}
|
||||
controller.getLight(0).set('enabled',false);
|
||||
controller.getLight(1).set('enabled',false);
|
||||
}
|
||||
|
||||
if (this.retry > 0) {
|
||||
delay = 5000 * this.retry;
|
||||
|
134
smartoffice/SODashServer/SODashServer/app/test.html
Normal file
134
smartoffice/SODashServer/SODashServer/app/test.html
Normal file
@ -0,0 +1,134 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Title</title>
|
||||
</head>
|
||||
<body>
|
||||
<script src="lib/jquery.js"
|
||||
integrity="sha256-laXWtGydpwqJ8JA+X9x2miwmaiKhn8tVmOVEigRNtP4="
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="lib/underscore.js"></script>
|
||||
<script src="lib/backbone.js"></script>
|
||||
<div id="output"></div>
|
||||
<script type="text/template" id="list-template">
|
||||
<ul></ul>
|
||||
</script>
|
||||
|
||||
<script type="text/template" id="todo-template">
|
||||
<li>
|
||||
<%= item.device_id %>
|
||||
<%= item.device_type %>
|
||||
</li>
|
||||
</script>
|
||||
|
||||
|
||||
<script>
|
||||
(function($) {
|
||||
|
||||
var mqttConfig = {
|
||||
orgId: 'qz0da4',
|
||||
userName: 'a-qz0da4-dfwwdkmkzr',
|
||||
appKey: '9txJEf3Cjy7hkSOvkv',
|
||||
prefix: 'iot-2/type/mDot/id/'
|
||||
};
|
||||
|
||||
sendAuthentication = function(xhr) {
|
||||
var user = 'a-qz0da4-dfwwdkmkzr';// your actual username
|
||||
var pass = '9txJEf3Cjy7hkSOvkv';// your actual password
|
||||
var token = user.concat(":", pass);
|
||||
xhr.setRequestHeader('Authorization', ("Basic ".concat(btoa(token))));
|
||||
};
|
||||
|
||||
var mDotModel = Backbone.Model.extend({});
|
||||
|
||||
var mDotCollection = Backbone.Collection.extend({
|
||||
model:mDotModel,
|
||||
url: 'https://qz0da4.internetofthings.ibmcloud.com/api/v0002/historian/types/mDot/devices/HIE-smart-campus-4'
|
||||
});
|
||||
|
||||
|
||||
|
||||
var ItemView = Backbone.View.extend({
|
||||
tagName:'li',
|
||||
className:'item',
|
||||
initialize: function() {
|
||||
this.template = _.template($('item-template').html());
|
||||
this.render();
|
||||
},
|
||||
render: function() {
|
||||
this.$el.html(this.template({item:this.model}));
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
var MDOT = Backbone.View.extend({
|
||||
model:mDotModel,
|
||||
el: $('#output'),
|
||||
|
||||
events: {
|
||||
'click button#refresh': 'refresh'
|
||||
}, initialize: function() {
|
||||
_.bindAll(this, 'render', 'refresh', 'update');
|
||||
//this.collection = new mDotCollection();
|
||||
this.collection.bind('change reset add remove', this.update, this);
|
||||
|
||||
this.template = _.template($('#list-template').html());
|
||||
this.render();
|
||||
//this.collection.
|
||||
}, refresh: function() {
|
||||
|
||||
}, update: function() {
|
||||
console.log('MDOT:update');
|
||||
console.log(this);
|
||||
|
||||
this.collection.each(function(model) {
|
||||
|
||||
var events = model.get('events');
|
||||
console.log(events);
|
||||
//that.$el.append(new TodoView({model: model.toJSON()}));
|
||||
});
|
||||
|
||||
this.render();
|
||||
},
|
||||
render: function() {
|
||||
console.log('render');
|
||||
that = this;
|
||||
this.$el.empty();
|
||||
this.$el.append(this.template());
|
||||
|
||||
this.collection.each(function(model) {
|
||||
|
||||
var events = model.get('events');
|
||||
console.log(events);
|
||||
//that.$el.append(new TodoView({model: model.toJSON()}));
|
||||
|
||||
|
||||
_(events).each(function(model) {
|
||||
console.log(model);
|
||||
that.$el.append(new ItemView({model: model.toJSON()}));
|
||||
})
|
||||
|
||||
});
|
||||
|
||||
|
||||
// var events = this.collection.model.get('events');
|
||||
// console.log(events);
|
||||
/*events.each(function(model) {
|
||||
that.$el.append(new ItemView({model: model.toJSON()}));
|
||||
});*/
|
||||
return this;
|
||||
}
|
||||
});
|
||||
|
||||
var mdotCollection = new mDotCollection();
|
||||
|
||||
var mdot = new MDOT({collection:mdotCollection});
|
||||
|
||||
mdotCollection.fetch({beforeSend: sendAuthentication});
|
||||
})(jQuery);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -22,51 +22,70 @@ var size = require('gulp-size');
|
||||
var debug = require('gulp-debug');
|
||||
|
||||
var filePath = {
|
||||
build_dir: './dist'
|
||||
};
|
||||
build_dir: './dist'
|
||||
};
|
||||
|
||||
gulp.task('scripts', function() {
|
||||
return gulp.src(['app/js/sowebsocket.js','app/js/colours.js','app/js/appv2.js'])
|
||||
.pipe(jshint('.jshintrc'))
|
||||
.pipe(jshint.reporter('default'))
|
||||
.pipe(concat('app.js'))
|
||||
// .pipe(stripDebug())
|
||||
.pipe(jsmin())
|
||||
.pipe(size({title: 'Scripts'}))
|
||||
.pipe(gulp.dest('dist/js'));
|
||||
});
|
||||
return gulp.src([
|
||||
'app/js/sowebsocket.js',
|
||||
'app/js/colours.js',
|
||||
'app/js/parts/clock.js',
|
||||
'app/js/parts/meetings.js',
|
||||
'app/js/parts/lights.js',
|
||||
'app/js/appv3.js'
|
||||
])
|
||||
.pipe(jshint('.jshintrc'))
|
||||
.pipe(jshint.reporter('default'))
|
||||
.pipe(concat('app.js'))
|
||||
.pipe(stripDebug())
|
||||
.pipe(jsmin())
|
||||
.pipe(size({title: 'Scripts'}))
|
||||
.pipe(gulp.dest('dist/js'));
|
||||
});
|
||||
|
||||
gulp.task('vendor', function() {
|
||||
return gulp.src(['bower_components/jquery/dist/jquery.min.js',
|
||||
'bower_components/mui/packages/cdn/js/mui.min.js',
|
||||
'bower_components/chroma-js/chroma.min.js',
|
||||
'bower_components/sugar/release/sugar-full.min.js',
|
||||
'app/lib/skycons.js',
|
||||
'app/lib/microevent.js'])
|
||||
.pipe(concat('vendor.js'))
|
||||
.pipe(uglify({mangle: false}))
|
||||
.pipe(size({title: 'Vendor'}))
|
||||
.pipe(gulp.dest('dist/js'));
|
||||
});
|
||||
|
||||
|
||||
|
||||
return gulp.src([
|
||||
'bower_components/jquery/dist/jquery.min.js',
|
||||
'bower_components/mui/packages/cdn/js/mui.min.js',
|
||||
'bower_components/chroma-js/chroma.min.js',
|
||||
'src/bower_modules/underscore/underscore-min.js',
|
||||
'src/bower_modules/backbone/backbone-min.js',
|
||||
'bower_components/sugar/release/sugar-full.min.js',
|
||||
'app/lib/skycons.js',
|
||||
'app/lib/microevent.js'
|
||||
])
|
||||
.pipe(concat('vendor.js'))
|
||||
.pipe(uglify({mangle: false}))
|
||||
.pipe(size({title: 'Vendor'}))
|
||||
.pipe(gulp.dest('dist/js'));
|
||||
});
|
||||
|
||||
gulp.task('styles', function() {
|
||||
return gulp.src(['app/css/mui.custom.css','app/css/material-icons.css','app/css/app.css'])
|
||||
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
|
||||
.pipe(cssnano())
|
||||
.pipe(concat('app.css'))
|
||||
.pipe(size({title: 'Styles'}))
|
||||
.pipe(gulp.dest('dist/css'));
|
||||
});
|
||||
return gulp.src([
|
||||
'app/css/mui.custom.css',
|
||||
'app/css/material-icons.css',
|
||||
'app/css/app.css'
|
||||
])
|
||||
.pipe(autoprefixer('last 2 version',
|
||||
'safari 5',
|
||||
'ie 8',
|
||||
'ie 9',
|
||||
'opera 12.1',
|
||||
'ios 6',
|
||||
'android 4'))
|
||||
.pipe(cssnano())
|
||||
.pipe(concat('app.css'))
|
||||
.pipe(size({title: 'Styles'}))
|
||||
.pipe(gulp.dest('dist/css'));
|
||||
});
|
||||
|
||||
gulp.task('partials', function() {
|
||||
|
||||
// Gulp.src(['app/partials/**/*']).pipe(gulp.dest('dist/partials'));
|
||||
// gulp.src(['app/libs/ejs_production.js']).pipe(gulp.dest('dist/libs'));
|
||||
// gulp.src(['app/libs/microevent.js']).pipe(gulp.dest('dist/libs'));
|
||||
gulp.src(['app/fav/**/*']).pipe(size({title: 'Partials'})).pipe(gulp.dest('dist/fav'));
|
||||
gulp.src(['app/fav/**/*']).pipe(size({title: 'Partials'})).pipe(gulp.dest(
|
||||
'dist/fav'));
|
||||
gulp.src(['app/gfx/censis_logo_white.png']).pipe(gulp.dest('dist/gfx'));
|
||||
});
|
||||
|
||||
@ -78,40 +97,41 @@ gulp.task('migrate', function() {
|
||||
});
|
||||
|
||||
gulp.task('index', function() {
|
||||
var sources = gulp.src(['js/apps.js', 'css/app.css'], {read: false});
|
||||
var sources = gulp.src(['js/apps.js', 'css/app.css'], {read: false});
|
||||
|
||||
return gulp.src(['app/index.html'])
|
||||
.pipe(htmlreplace({
|
||||
css: 'css/app.css',
|
||||
js: 'js/app.js',
|
||||
vendor: 'js/vendor.js',
|
||||
fonts: 'fonts/fonts.css'
|
||||
}))
|
||||
.pipe(htmlmin({removeComments: true, collapseWhitespace: true, keepClosingSlash: true}))
|
||||
.pipe(size({title: 'Index'}))
|
||||
.pipe(gulp.dest('dist/'));
|
||||
});
|
||||
return gulp.src(['app/index.html'])
|
||||
.pipe(htmlreplace({
|
||||
css: 'css/app.css',
|
||||
js: 'js/app.js',
|
||||
vendor: 'js/vendor.js',
|
||||
fonts: 'fonts/fonts.css'
|
||||
}))
|
||||
.pipe(htmlmin({
|
||||
removeComments: true,
|
||||
collapseWhitespace: true,
|
||||
keepClosingSlash: true
|
||||
}))
|
||||
.pipe(size({title: 'Index'}))
|
||||
.pipe(gulp.dest('dist/'));
|
||||
});
|
||||
|
||||
var options = { };
|
||||
var options = {};
|
||||
|
||||
gulp.task('fonts', function() {
|
||||
return gulp.src('./fonts.list')
|
||||
.pipe(googleWebFonts(options))
|
||||
.pipe(googleWebFonts(options))
|
||||
.pipe(size({title: 'Fonts'}))
|
||||
.pipe(gulp.dest('dist/fonts'))
|
||||
;
|
||||
.pipe(gulp.dest('dist/fonts'));
|
||||
});
|
||||
|
||||
|
||||
gulp.task('clean', function() {
|
||||
return del(['dist']);
|
||||
});
|
||||
|
||||
return del(['dist']);
|
||||
});
|
||||
|
||||
gulp.task('default', ['clean'], function() {
|
||||
gulp.start('styles', 'scripts', 'vendor', 'fonts', 'partials', 'index');
|
||||
});
|
||||
gulp.start('styles', 'scripts', 'vendor', 'fonts', 'partials', 'index');
|
||||
});
|
||||
|
||||
gulp.task('Cordova', ['clean'], function() {
|
||||
gulp.start('styles', 'scripts', 'vendor', 'fonts', 'index');
|
||||
});
|
||||
gulp.start('styles', 'scripts', 'vendor', 'fonts', 'index');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user