Restructure for gulp build of app.js

This commit is contained in:
Matt 2016-04-12 20:53:28 -04:00
parent 4b6d11cdc8
commit 6680abdce3
9 changed files with 142 additions and 21 deletions

18
app/gulpfile.js Normal file
View File

@ -0,0 +1,18 @@
var gulp = require('gulp'),
concat = require('gulp-concat');
var scripts = [
'./src/jquery-1.11.3.min.js',
'./src/w2ui-1.4.3.min.js',
'./src/chroma.min.js',
'./src/index.js'
];
gulp.task('js', function () {
'use strict';
return gulp.src(scripts)
.pipe(concat('app.js'))
.pipe(gulp.dest('./js/'));
});
gulp.task('default', ['js']);

View File

@ -9,16 +9,8 @@
<link href="./css/app.css" rel="stylesheet">
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<button></button>
</div>
</div>
<nav id="toolbar">
</nav>
<script src="./js/jquery-1.11.3.min.js"></script>
<script src="./js/w2ui-1.4.3.min.js"></script>
<script src="./js/chroma.min.js"></script>
<script src="./js/index.js"></script>
<script src="./js/app.js"></script>
</body>
</html>

84
app/js/app.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -1,10 +0,0 @@
var ipcRenderer = require('electron').ipcRenderer,
light = {};
//console.log(ipcRenderer.sendSync('light', { 'fuck' : true }) );
light.set = function (color) {
'use strict';
console.log('color: ' + color.join(','));
ipcRenderer.sendSync('light', color);
};

View File

@ -25,7 +25,10 @@
"devDependencies": {
"electron-packager": "^6.0.2",
"electron-prebuilt": "^0.37.5",
"electron-rebuild": "^1.1.3"
"electron-rebuild": "^1.1.3",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-less": "^3.0.5"
},
"dependencies": {
"node-notifier": "^4.5.0",

34
app/src/index.js Normal file
View File

@ -0,0 +1,34 @@
var ipcRenderer = require('electron').ipcRenderer,
light = {};
//console.log(ipcRenderer.sendSync('light', { 'fuck' : true }) );
light.set = function (color) {
'use strict';
console.log('color: ' + color.join(','));
ipcRenderer.sendSync('light', color);
};
var init = function () {
'use strict';
$('#toolbar').w2toolbar({
name: 'toolbar',
items: [
{ type: 'check', id: 'item1', caption: 'Check', img: 'icon-page', checked: true },
{ type: 'break', id: 'break0' },
{ type: 'menu', id: 'item2', caption: 'Drop Down', img: 'icon-folder', items: [
{ text: 'Item 1', icon: 'icon-page' },
{ text: 'Item 2', icon: 'icon-page' },
{ text: 'Item 3', value: 'Item Three', icon: 'icon-page' }
]},
{ type: 'break', id: 'break1' },
{ type: 'radio', id: 'item3', group: '1', caption: 'Radio 1', icon: 'fa-star', checked: true },
{ type: 'radio', id: 'item4', group: '1', caption: 'Radio 2', icon: 'fa-star-empty' },
{ type: 'spacer' },
{ type: 'button', id: 'item5', caption: 'Item 5', icon: 'fa-home' }
]
});
};
init();