Skip to content

Commit

Permalink
Display Bootstrap 3 sample templates using Jade, Node and Express
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdelkrim committed Aug 20, 2013
1 parent bcfa04b commit 1803298
Show file tree
Hide file tree
Showing 196 changed files with 39,911 additions and 3 deletions.
58 changes: 58 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
###Security###
*-config.json
*mysecrets*

###Intermediate files###
_gen_dev
_gen_dist
_generated

###WebStormIDE###
.idea

###Istanbul###
coverage
libpeerconnection.log

###Node###

lib-cov
*.seed
*.log
Expand All @@ -12,3 +30,43 @@ logs
results

npm-debug.log
node_modules

###OSX###

.DS_Store
.AppleDouble
.LSOverride
Icon


# Thumbnails
._*

# Files that might appear on external disk
.Spotlight-V100
.Trashes


# Installer logs
pip-log.txt

# Unit test / coverage reports
.coverage
.tox
nosetests.xml

# Translations
*.mo

# Mr Developer
.mr.developer.cfg
.project
.pydevproject


###SublimeText###

# SublimeText project files
*.sublime-workspace
*.sublime-project
23 changes: 23 additions & 0 deletions .jshintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"bitwise": true,
"camelcase": true,
"boss": true,
"curly": true,
"eqeqeq": true,

"eqnull": true,
"immed": true,
"indent": 4,
"latedef": true,
"newcap": true,
"noarg": true,
"node": true,
"quotmark": true,
"regexp": true,
"strict": true,
"sub": true,
"trailing": true,
"undef": true,
"unused": true,
"white": true
}
3 changes: 3 additions & 0 deletions .nodemonignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Generated by grunt-nodemon
*.md
node_modules/**
133 changes: 133 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,133 @@
/**
* Created with JetBrains WebStorm.
* User: abdelkrim
* Date: 2013-08-21
* Time: 00:00
* Copyright (c) 2013 ALT-F1, We believe in the projects we work on™
*/

'use strict';

// Mount folder to connect.
var mountFolder = function (connect, dir) {
return connect.static(require('path').resolve(dir));
};


module.exports = function (grunt) {

// Load all Grunt tasks

require('matchdep').filterDev('*').forEach(grunt.loadNpmTasks);

// Project configuration.
grunt.initConfig({
appConfig: grunt.file.readJSON('./app/config/appConfig.json'),


// Task configuration.

// Clean folders before compile assets.
clean: {
dev: '<%= appConfig.app.dev %>',
options: {
force: true
}
},

// Start local server.
connect: {
dev: {
options: {
port: '<%= appConfig.app.devPort %>',
hostname: 'localhost',
middleware: function (connect) {
return [
//livereloadSnippet,
mountFolder(connect, grunt.template.process('<%= appConfig.app.dev %>')),
mountFolder(connect, grunt.template.process('<%= appConfig.app.src %>'))
];
}
}
}
},


jshint: {
options: {
jshintrc: '.jshintrc'
},
gruntfile: {
src: 'Gruntfile.js'
},
app: {
src: ['<%= appConfig.app.src %>/<%= appConfig.directories.src %>/*.js', '<%= appConfig.app.src %>/routes/**/*.js']
}
},


nodemon: {
src: {
options: {
file: '<%= appConfig.app.src %>/<%= appConfig.app.rootPage %>',
args: ['development'],
nodeArgs: ['--debug'],
ignoredFiles: ['*.md', 'node_modules/**'],
watchedExtensions: ['js', 'jade', 'css'],
watchedFolders: ['<%= appConfig.app.src %>', '<%= appConfig.app.src %>/routes/**', '<%= appConfig.app.src %>/views/**'],
delayTime: 1,
env: {
PORT: '<%= appConfig.app.srcPort %>'
},
cwd: __dirname
}
}
},

// Open a web server with a given URL.

open: {
server: {
path: 'http://localhost:<%= appConfig.app.devPort %>'
}
},

server: {
port: '<%= appConfig.app.devPort %>',
base: './'
},

watch: {
//every time a file is changed, a task is performed
gruntfile: {
files: ['<%= jshint.app.src %>', '<%= jshint.gruntfile.src %>'],
tasks: ['jshint:gruntfile', 'jshint:app' ]
},
app: {
files: '{<%= appConfig.app.dev %>,<%= appConfig.app.src %>}/**/*.{css,html,js,jpg,jpeg,png}',
options: {
livereload: '<%= appConfig.app.livereloadPort %>'
}
},
jade: {
files: '<%= appConfig.app.src %>/**/*.jade',
tasks: 'compile:jade',
options: {
livereload: '<%= appConfig.app.livereloadPort %>'
}
}
}
}
)
;

// Start local server and watch for changes in files.
grunt.registerTask('src', [
'jshint',
'nodemon:src'
]);

// Available tasks
grunt.registerTask('default', ['src']);
}
;
File renamed without changes.
91 changes: 88 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,89 @@
bootstrap3-jade-node-
=====================
bootstrap3-jade-node
====================

Bootstrap 3 templated by Jade
[Bootstrap 3 samples] rendered using [Jade], [Node], [Express] and [Grunt]

# bootstrap3-jade-node

The secrets I can't share with anyone

## Getting Started
Install the module with: `npm install`
Run with: `Grunt`

## Documentation
start the server

## Examples
open [http://localhost:3001/](http://localhost:3001/)
open the [Starter template](http://localhost:3001/template/starter-template)

## Contributing
Feel free to help me convert all the templates:

+ [ ] carousel
+ [ ] grid
+ [ ] jumbotron
+ [ ] jumbotron-narrow
+ [ ] justified-nav
+ [ ] navbar
+ [ ] navbar-fixed-top
+ [ ] navbar-static-top
+ [ ] non-responsive
+ [ ] offcanvas
+ [ ] screenshots
+ [ ] signin
+ [X] starter-template
+ [ ] sticky-footer
+ [ ] sticky-footer-navbar
+ [ ] theme

## Release History

v2013-08-21

+ [Twitter Bootstrap] 3 is just released, it is time to convert HTML into Jade templates

## License
Copyright (c) 2013 ALT-F1, We believe in the projects we work on™
Licensed under the MIT license.



[Bootstrap 3 samples]: http://twbs.github.io/bootstrap/getting-started/#examples
[ALT-F1]: http://www.alt-f1.be
[AngularJS]: http://angularjs.org/
[Connect]: http://www.senchalabs.org/connect/
[Express]: http://expressjs.com/
[Font Awesome]: http://fortawesome.github.io/Font-Awesome/
[Google APIs]: https://developers.google.com/compute/docs/api/libraries
[Google Compute Engine API Reference]: https://developers.google.com/compute/docs/reference/latest/
[Google Compute Engine API]: https://developers.google.com/compute/docs/api/libraries
[Google Compute Engine]: https://cloud.google.com/products/compute-engine
[Grunt-nodemon]: https://github.com/remy/nodemon
[Grunt]: http://gruntjs.com/
[Istanbul]: https://github.com/gotwarlost/istanbul
[Jade]: http://jade-lang.com/
[Jasmine]: http://pivotal.github.io/jasmine/
[Javascript]: https://developer.mozilla.org/en-US/docs/Web/JavaScript
[Karma]: http://karma-runner.github.io/
[log4js]: https://github.com/nomiddlename/log4js-node
[matchdep]: https://npmjs.org/package/matchdep
[Mocha]: http://visionmedia.github.io/mocha/
[MongoDB]: http://www.mongodb.org/
[MongoHQ]: https://www.mongohq.com
[MongoLab]: https://mongolab.com
[Mongoose]: http://mongoosejs.com/
[Node inspector]: https://github.com/node-inspector/node-inspector
[NodeJS]: http://nodejs.org/
[NPM]: http://npmjs.org/
[Professional Node JS book]: http://astore.amazon.fr/i14ynet-21/detail/1118185463
[Professional Node JS Source Code]: https://github.com/ALT-F1/nodejs-professional
[Python]: http://www.python.org
[SIMOGGA COMPUTE WEB source code]: https://bitbucket.org/amiasystems/simogga-compute-web
[SIMOGGA CORE source code]: https://bitbucket.org/amiaconsulting/simogga-core
[Spacelab stylesheet]: http://bootswatch.com/2/spacelab/
[Twitter Bootstrap for Compass]: https://github.com/vwall/compass-twitter-bootstrap
[Twitter Bootstrap]: http://getbootstrap.com/
[Ubuntu]: http://www.ubuntu.com/
[Yeoman]: http://yeoman.io/
51 changes: 51 additions & 0 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
creating a Express app initializing it with the HelloWorld message
*/
'use strict';

var PORT_LISTENER = 3001;
console.log('I am listening to this port: http://localhost:%s', PORT_LISTENER);

var express = require('express'),
http = require('http'),
path = require('path');

var appConfig = require('./config/appConfig.json');

var app = express();

// all environments
app.set('port', process.env.PORT || PORT_LISTENER);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.favicon());
app.use(express.logger('dev'));
app.use(express.bodyParser({ keepExtensions: true, uploadDir: path.join(__dirname, appConfig.directories.publicDir) }));
app.use(express.methodOverride());
app.use(express.cookieParser('my v3ry s3cr3t C00k1e k3y d0nt y0u th1nk?'));
app.use(express.session({
secret: 'my l1ttl3 s3cret s3ss10n k3y isnt it?',
maxAge: 3600000
}));


//routes
require('./routes/index')(app);

app.use(app.router);
app.use(express.static(path.join(__dirname, appConfig.directories.publicDir)));

app.use(function (req, res, next) {
console.log('req.body: ' + JSON.stringify(req.body));
next();
});

// development only
if ('development' === app.get('env')) {
app.use(express.errorHandler());
}


http.createServer(app).listen(app.get('port'), function () {
console.log('Express server listening on port ' + app.get('port'));
});
19 changes: 19 additions & 0 deletions app/config/appConfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"directories": {
"appDir": "/app",
"dataDir": "/data",
"publicDir": "/public",
"privateDir": "/private"
},
"app": {
"name": "Bootstrap 3 rendered by Jade, Node, Express and Grunt",
"rootPage": "app.js",
"dev": "_gen_dev",
"devPort": 3001,
"dist": "_gen_dist",
"distPort": 3001,
"livereloadPort": 1337,
"src": "app",
"srcPort": "3001"
}
}
Loading

0 comments on commit 1803298

Please sign in to comment.