Skip to content

Commit 7444d1d

Browse files
committed
first commit
1 parent 23487de commit 7444d1d

30 files changed

+1217
-0
lines changed

.gitignore

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
logs
2+
*.log
3+
npm-debug.log*
4+
5+
# Runtime data
6+
pids
7+
*.pid
8+
*.seed
9+
10+
# Dependency directory
11+
# https://docs.npmjs.com/misc/faq#should-i-check-my-node-modules-folder-into-git
12+
node_modules/
13+
bower_components/
14+
15+
.sass-cache/
16+
*.css.map
17+
.idea/
18+
19+
# Compiled source #
20+
###################
21+
*.o
22+
23+
# Packages #
24+
############
25+
*.gz
26+
*.iso
27+
*.jar
28+
*.rar
29+
*.tar
30+
*.zip
31+
32+
# databases #
33+
######################
34+
*.sql
35+
*.sqlite
36+
37+
# OS generated files #
38+
######################
39+
.DS_Store
40+
._*
41+
ehthumbs.db
42+
Thumbs.db

Gulpfile.js

+115
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
var gulp = require('gulp'),
2+
//sass = require('gulp-ruby-sass'),
3+
sass = require('gulp-sass'),
4+
gulp = require('gulp'),
5+
$ = require('gulp-load-plugins')({
6+
pattern: ['gulp-*', 'gulp.*', 'main-bower-files', 'event-stream'],
7+
replaceString: /\bgulp[\-.]/
8+
}),
9+
folderSources = {
10+
assetDir: './assets/',
11+
publicDir: './public/',
12+
bowerDir: './bower_components/',
13+
es6CompiledDir: './public/es6Compiled/'
14+
},
15+
//ES6 Stuff
16+
//traceur = require('gulp-traceur'),//using babel not traceur (http://weblogs.asp.net/dwahlin/getting-started-with-es6-%E2%80%93-transpiling-es6-to-es5)
17+
babel = require('gulp-babel'),
18+
plumber = require('gulp-plumber');
19+
//END ES6 Stuff
20+
21+
gulp.task('fonts', function() {
22+
gulp.src(folderSources.bowerDir + 'fontawesome/fonts/**.*')
23+
.pipe(gulp.dest('./public/fonts'));
24+
});
25+
26+
gulp.task('image', function(){
27+
gulp.src(folderSources.assetDir + 'images/*')
28+
.pipe($.imagemin())
29+
.pipe(gulp.dest(folderSources.publicDir + 'images'));
30+
});
31+
32+
gulp.task('watch', function(){
33+
$.livereload.listen();
34+
35+
gulp.watch(folderSources.assetDir + 'sass/*.scss', ['styles']);
36+
gulp.watch(folderSources.assetDir + 'js/*.js', ['scripts', 'babel']);
37+
});
38+
39+
gulp.task('sass', function () {
40+
gulp.src(folderSources.assetDir + 'sass/*.scss')
41+
.pipe(sass().on('error', function(err) {
42+
console.error('Error!', err.message);
43+
}))
44+
.pipe(gulp.dest(folderSources.publicDir + 'stylesheets'))
45+
.pipe($.livereload());
46+
});
47+
48+
//There is a javascript with main script, so compile it along with bower scripts
49+
gulp.task('mainScripts', function(){
50+
var filesToCompile = [
51+
folderSources.assetDir + 'js/main.js'
52+
];
53+
54+
compileScripts('map.min.js', filesToCompile);
55+
});
56+
57+
//No login specific js, just
58+
gulp.task('loginScripts', function(){
59+
compileScripts('login.min.js');
60+
});
61+
62+
gulp.task('registerScripts', function(){
63+
compileScripts('register.min.js');
64+
});
65+
66+
//Compile just scripts
67+
gulp.task('scripts', [
68+
'mainScripts',
69+
'loginScripts',
70+
'registerScripts'
71+
]);
72+
73+
//Compile all pieces
74+
gulp.task('default', [
75+
'scripts',
76+
'sass',
77+
'image',
78+
'fonts',
79+
'watch'
80+
]);
81+
82+
/***************
83+
* Functions
84+
**************/
85+
//Script compiling
86+
function compileScripts(minFileName, filesArray) {
87+
var concat = $.concat,
88+
vendorFiles,
89+
projectFiles;
90+
91+
vendorFiles = gulp.src($.mainBowerFiles())
92+
.pipe($.filter('*.js'))
93+
.pipe($.concat('vendor.js'));
94+
95+
if(typeof filesArray !== 'undefined') {
96+
projectFiles = gulp.src(filesArray)
97+
//.pipe($.jshint())
98+
//.pipe($.jshint.reporter('default'))
99+
.pipe($.concat('app.js'))
100+
//babel
101+
.pipe(plumber())
102+
.pipe(babel());
103+
}
104+
105+
//projectFiles won't be avail if there is no filesArray sent in, so just use vendorFiles, which is bower stuff :)
106+
$.eventStream.concat(vendorFiles, projectFiles || vendorFiles)
107+
.pipe($.order([
108+
'vendor.js',
109+
'app.js'
110+
]))
111+
.pipe(concat(minFileName))
112+
.pipe($.uglify())
113+
.pipe(gulp.dest(folderSources.publicDir + 'scripts'))
114+
.pipe($.livereload());
115+
}

app.js

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
var express = require('express'),
2+
path = require('path'),
3+
//fs = require('fs'),//added in tutorial
4+
hbs = require('hbs'),//added in tutorial
5+
exphbs = require('express-handlebars'),
6+
//favicon = require('serve-favicon'),
7+
logger = require('morgan'),
8+
cookieParser = require('cookie-parser'),
9+
bodyParser = require('body-parser'),
10+
//index includes all includes/requires
11+
requires = require('./server/routes'),//will look for index.js
12+
13+
//app express object
14+
app = express();
15+
16+
// view engine setup
17+
app.set('views', path.join(__dirname, 'views'));
18+
app.set('view engine', 'hbs');
19+
20+
//Register handlebars directories so files are known where to be read from
21+
hbs.registerPartials(__dirname + '/views/partials');
22+
hbs.registerPartials(__dirname + '/views/partials/loginReg');
23+
hbs.registerPartials(__dirname + '/views/partials/includes');
24+
25+
// uncomment after placing your favicon in /public
26+
//app.use(favicon(path.join(__dirname, 'public', 'favicon.ico')));
27+
app.use(logger('dev'));
28+
app.use(bodyParser.json());
29+
app.use(bodyParser.urlencoded({ extended: false }));
30+
app.use(cookieParser());
31+
32+
//Routing files and dirs
33+
app.use(express.static(path.join(__dirname, 'public')));
34+
35+
app.use('/bootstrap', express.static(__dirname + '/bower_components/bootstrap/dist/js'));
36+
app.use('/jquery', express.static(__dirname + '/bower_components/jquery/dist'));
37+
app.use('/handlebars', express.static(__dirname + '/bower_components/handlebars'));
38+
39+
/*****************
40+
URL Routing
41+
******************/
42+
//Front facing site, not logged in
43+
//app.use('/', index.loginPage);
44+
app.get('/', requires.login.loginPage);
45+
46+
/*****************
47+
Register page
48+
*****************/
49+
app.get('/register', requires.register.registerPage);
50+
app.post('/register', requires.register.registerAction);
51+
52+
// catch 404 and forward to error handler
53+
app.use(function(req, res, next) {
54+
var err = new Error('Not Found, AHHHHHH');
55+
err.status = 404;
56+
next(err);
57+
});
58+
59+
// error handlers
60+
61+
// development error handler
62+
// will print stacktrace
63+
if (app.get('env') === 'development') {
64+
app.use(function(err, req, res, next) {
65+
res.status(err.status || 500);
66+
res.render('error', {
67+
message: err.message,
68+
error: err
69+
});
70+
});
71+
}
72+
73+
// production error handler
74+
// no stacktraces leaked to user
75+
app.use(function(err, req, res, next) {
76+
res.status(err.status || 500);
77+
res.render('error', {
78+
message: err.message,
79+
error: {}
80+
});
81+
});
82+
83+
module.exports = app;

assets/images/ucf.jpg

8.76 KB
Loading

assets/js/main.js

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
var mainJs = (function() {
2+
3+
/**
4+
* bindListeners Listners go here
5+
*/
6+
function bindListeners() {
7+
8+
}
9+
10+
/**
11+
* init Called on page load
12+
*/
13+
function init() {
14+
bindListeners();
15+
}
16+
17+
return {
18+
init: init
19+
};
20+
21+
}());

assets/sass/login.scss

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
@import 'partials/imports';
2+

0 commit comments

Comments
 (0)