Skip to content

Commit 073f4f4

Browse files
committed
v1.0.0 of the template
1 parent b7f2f7a commit 073f4f4

20 files changed

+237
-0
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ build/Release
2525
# Dependency directory
2626
# https://www.npmjs.org/doc/misc/npm-faq.html#should-i-check-my-node_modules-folder-into-git
2727
node_modules
28+
dist

.jshintrc

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"bitwise": true,
3+
"curly": true,
4+
"eqeqeq": true,
5+
"forin": true,
6+
"freeze": true,
7+
"latedef": true,
8+
"maxdepth": 3,
9+
"maxparams": 4,
10+
"maxstatements": 5,
11+
"nonew": true,
12+
"strict": true,
13+
"undef": true,
14+
"unused": true,
15+
"esnext": true,
16+
"loopfunc": true,
17+
"browser": true,
18+
"devel": true,
19+
"jasmine": true,
20+
"jquery": true,
21+
"mocha": true,
22+
"node": true
23+
}

Makefile

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
APP_NAME=app
2+
ELECTRON_VERSION=0.28.1
3+
OUTPUT_DIR=dist
4+
5+
apps: windows-app windows-app-64 mac-app mac-app-64 linux-app linux-app-64
6+
7+
globals:
8+
npm install -g electron-prebuilt
9+
npm install -g electron-packager
10+
npm install -g node-inspector
11+
npm install -g gulp
12+
13+
clean-apps:
14+
rm -rf dist && mkdir distgit
15+
windows-app:
16+
electron-packager . ${APP_NAME} --platform=win32 --arch=ia32 --version=${ELECTRON_VERSION} --out=${OUTPUT_DIR}/win32
17+
windows-app-64:
18+
electron-packager . ${APP_NAME} --platform=win32 --arch=x64 --version=${ELECTRON_VERSION} --out=${OUTPUT_DIR}/win64
19+
mac-app:
20+
electron-packager . ${APP_NAME} --platform=darwin --arch=x64 --version=${ELECTRON_VERSION} --out=${OUTPUT_DIR}/mac64
21+
linux-app:
22+
electron-packager . ${APP_NAME} --platform=linux --arch=ia32 --version=${ELECTRON_VERSION} --out=${OUTPUT_DIR}/linux32
23+
linux-app-64:
24+
electron-packager . ${APP_NAME} --platform=linux --arch=x64 --version=${ELECTRON_VERSION} --out=${OUTPUT_DIR}/linux64

config.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"version": "1.0.0",
3+
"views_dir": "views",
4+
"root_view": "index.html"
5+
}

gulpfile.js

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
'use strict';
2+
3+
// Non Gulp npm modules
4+
var del = require('del');
5+
6+
// Gulp Modules
7+
var gulp = require('gulp');
8+
var gutil = require('gulp-util');
9+
var plugins = require('gulp-load-plugins')();
10+
11+
var sassRoot = 'public/scss';
12+
var cssRoot = 'public/css';
13+
var jsRoot = 'public/js';
14+
var jsnextRoot = 'public/js-next';
15+
16+
function handleError(err) {
17+
console.log(err.toString());
18+
}
19+
20+
// ##########################################################################
21+
// ##########################################################################
22+
23+
gulp.task('clean:styles', function(cb) {
24+
del([
25+
'**/.sass-cache/**',
26+
], cb);
27+
});
28+
29+
gulp.task('build-js-next', function() {
30+
return gulp.src(jsnextRoot+'/**/*.js')
31+
.pipe(plugins.plumber())
32+
.pipe(plugins.notify('Compiling <%= file.relative %> into ES5 compatible code...'))
33+
.pipe(plugins.babel()).on('error', handleError)
34+
.pipe(gulp.dest(jsRoot));
35+
});
36+
37+
gulp.task('build-sass', function() {
38+
return gulp.src(sassRoot+'/*.scss')
39+
.pipe(plugins.plumber())
40+
.pipe(plugins.notify('Compile Sass File: <%= file.relative %>...'))
41+
.pipe(plugins.autoprefixer('last 10 versions'))
42+
.pipe(plugins.sass({
43+
style: 'compressed'
44+
})).on('error', handleError)
45+
.pipe(gulp.dest(cssRoot));
46+
});
47+
48+
// ##########################################################################
49+
// ##########################################################################
50+
51+
gulp.task('watch-js-next', function() {
52+
plugins.notify('JS-Next Stream is Active...');
53+
gulp.watch(jsnextRoot+'/**/*.js', ['build-js-next']);
54+
});
55+
56+
gulp.task('watch-sass', function() {
57+
plugins.notify('Sass Stream is Active...');
58+
gulp.watch(sassRoot+'/**/*.scss', ['build-sass']);
59+
});
60+
61+
// ##########################################################################
62+
// ##########################################################################
63+
64+
gulp.task('default', function() {
65+
gutil.log('Default has not been defined...');
66+
});
67+
68+
gulp.task('clean', ['clean:styles']);
69+
gulp.task('watch', ['watch-sass', 'watch-js-next']);

main.js

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
'use strict';
2+
3+
var _ = require('lodash');
4+
var fs = require('fs');
5+
var app = require('app');
6+
var path = require('path');
7+
var BrowserWindow = require('browser-window');
8+
9+
// ####################################################
10+
// ####################################################
11+
12+
// Report crashes to our server.
13+
require('crash-reporter').start();
14+
15+
var mainWindow = null;
16+
var options = JSON.parse(fs.readFileSync('config.json', 'utf8'));
17+
18+
options = _.extend({
19+
// ADDITIONAL CUSTOM SETTINGS
20+
}, options);
21+
22+
// Quit when all windows are closed.
23+
app.on('window-all-closed', function() {
24+
if(process.platform !== 'darwin') { app.quit(); }
25+
});
26+
27+
app.on('ready', function() {
28+
mainWindow = new BrowserWindow({width: 800, height: 600});
29+
mainWindow.loadUrl(path.join('file://', __dirname, options.views_dir, options.root_view));
30+
// mainWindow.openDevTools();
31+
32+
mainWindow.on('closed', function() {
33+
mainWindow = null;
34+
});
35+
});

package.json

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
{
2+
"name": "Electron-Boilerplate",
3+
"version": "1.0.0",
4+
"description": "A simple electron app with CLI tasks for automatically building the app",
5+
"main": "main.js",
6+
"scripts": {
7+
"preinstall": "make globals",
8+
"start": "electron .",
9+
"test": "node-inspector && electron --debug=5858 && ",
10+
"prepublish": "make"
11+
},
12+
"repository": {
13+
"type": "git",
14+
"url": "https://github.com/Stephn-R/Electron-Boilerplate.git"
15+
},
16+
"keywords": [],
17+
"author": "[email protected]",
18+
"license": "GNU GPL v2 License",
19+
"bugs": {
20+
"url": "https://github.com/Stephn-R/Electron-Boilerplate/issues"
21+
},
22+
"homepage": "https://github.com/Stephn-R/Electron-Boilerplate",
23+
"devDependencies": {
24+
"del": "^1.2.0",
25+
"electron-packager": "^4.1.3",
26+
"gulp": "^3.9.0",
27+
"gulp-autoprefixer": "^2.3.1",
28+
"gulp-babel": "^5.1.0",
29+
"gulp-clean": "^0.3.1",
30+
"gulp-load-plugins": "^1.0.0-rc.1",
31+
"gulp-notify": "^2.2.0",
32+
"gulp-plumber": "^1.0.1",
33+
"gulp-sass": "^2.0.1",
34+
"gulp-shell": "^0.4.2",
35+
"gulp-uglify": "^1.2.0",
36+
"gulp-util": "^3.0.5"
37+
},
38+
"dependencies": {
39+
"electron-prebuilt": "^0.28.1",
40+
"lodash": "^3.9.3"
41+
}
42+
}

public/css/style.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
html, body {
2+
width: 100%;
3+
height: 100%; }

public/js-next/sample.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
let x = 2;
2+
let y = 2;
3+
4+
console.log(x+y);

public/js/sample.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
"use strict";
2+
3+
var x = 2;
4+
var y = 2;
5+
6+
console.log(x + y);

public/scss/base/_colors.scss

Whitespace-only changes.

public/scss/base/_fonts.scss

Whitespace-only changes.

public/scss/base/_functions.scss

Whitespace-only changes.

public/scss/base/_icons.scss

Whitespace-only changes.

public/scss/base/_mixins.scss

Whitespace-only changes.

public/scss/base/base.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
@import 'functions';
2+
@import 'mixins';
3+
@import 'colors';
4+
@import 'fonts';
5+
@import 'icons';

public/scss/includes/_footer.scss

Whitespace-only changes.

public/scss/includes/_nav.scss

Whitespace-only changes.

public/scss/style.scss

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@import 'base/base';
2+
3+
@import 'includes/nav';
4+
@import 'includes/footer';
5+
6+
html, body {
7+
width: 100%;
8+
height: 100%;
9+
}

views/index.html

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<title>Hello World!</title>
5+
</head>
6+
<body>
7+
<h1>Hello World!</h1>
8+
We are using io.js <script>document.write(process.version)</script>
9+
and Electron <script>document.write(process.versions['electron'])</script>.
10+
</body>
11+
</html>

0 commit comments

Comments
 (0)