This repository has been archived by the owner on Oct 22, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jenn Schiffer
committed
May 22, 2014
0 parents
commit 4f360da
Showing
13 changed files
with
235 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
node_modules/* | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module.exports = function(grunt) { | ||
|
||
grunt.initConfig({ | ||
pkg: grunt.file.readJSON('package.json'), | ||
|
||
jshint: { | ||
options: { | ||
node: true | ||
}, | ||
all: [ | ||
'Gruntfile.js', | ||
'app.js', | ||
'public/js/*.js' | ||
] | ||
}, | ||
|
||
csslint: { | ||
all: { | ||
src: ['public/css/base.css'] | ||
} | ||
} | ||
|
||
}); | ||
|
||
grunt.loadNpmTasks('grunt-contrib-jshint'); | ||
grunt.loadNpmTasks('grunt-contrib-csslint'); | ||
|
||
grunt.registerTask('test', ['jshint', 'csslint']); | ||
|
||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// require express, stylus + nib | ||
var express = require('express'); | ||
var stylus = require('stylus'); | ||
var nib = require('nib'); | ||
|
||
// require route scripts | ||
var routes = require('./routes/index'); | ||
var routesPage = require('./routes/page'); | ||
|
||
// create express app | ||
var app = express(); | ||
|
||
// set views and engine as jade | ||
app.set('views', __dirname + '/views'); | ||
app.set('view engine', 'jade'); | ||
|
||
// compile stylus and import nib for reset/css3 | ||
function compile(str, path) { | ||
return stylus(str) | ||
.set('filename', path) | ||
.set('compress', true) | ||
.use(nib()) | ||
.import('nib'); | ||
} | ||
app.use(stylus.middleware({ | ||
src: __dirname + '/public', | ||
compile: compile | ||
}) | ||
); | ||
|
||
// set dir for static css/js/assets | ||
app.use(express.static(__dirname + '/public')); | ||
|
||
// set up routes | ||
app.use('/', routes); | ||
app.use('/page', routesPage); | ||
|
||
// on `node app.js` app will run at localhost:5678 | ||
app.listen('5678'); | ||
|
||
module.exports = app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2014 Jenn Schiffer | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
{ | ||
"name": "express-playground", | ||
"description": "just a base for a node app using express, jade, and stylus", | ||
"version": "0.0.1", | ||
"private": true, | ||
"dependencies": { | ||
"express": "4.x", | ||
"jade": "*", | ||
"stylus": "*", | ||
"nib": "*" | ||
}, | ||
"devDependencies": { | ||
"grunt": "~0.4.4", | ||
"grunt-contrib-jshint": "~0.10.0", | ||
"grunt-contrib-csslint": "~0.2.0" | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
global-reset() | ||
|
||
body | ||
font-family 'Courier New', monospace | ||
margin 20px | ||
|
||
h1 | ||
font-weight bold | ||
margin 1em 0 | ||
font-size 2em | ||
|
||
h2 | ||
font-weight bold | ||
margin 1em 0 | ||
font-size 1.5em | ||
|
||
nav ul li | ||
display inline-block | ||
|
||
a | ||
padding 10px | ||
&:hover | ||
background-color blue | ||
color white | ||
|
||
.container | ||
padding 10px | ||
|
||
p | ||
margin 1em 0 | ||
|
||
footer | ||
font-size .8em | ||
font-style italic |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# express playground | ||
|
||
This is just a base for a node app using express, jade, and stylus. | ||
|
||
## dependencies | ||
|
||
* [express](http://expressjs.com/) - node web app framework, using version 4 because "hash tag yo-lo" | ||
* [jade](http://jade-lang.com/) - templating engine | ||
* [stylus](http://learnboost.github.io/stylus/) - css preprocessor, compiled in `app.js` | ||
* [grunt](http://gruntjs.com/) - currently just used for jshint'ing & csslint'ing | ||
|
||
## running it | ||
|
||
* `grunt test` to [jshint](http://www.jshint.com/) & [csslint](http://csslint.net/) | ||
* `node app.js` to run at `localhost:5678` | ||
|
||
## made by jenn | ||
|
||
* [@jennschiffer](http://twitter.com/jennschiffer) | ||
* email: jenn @ dotbiz.info (yes, this is a real email) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// require express and create router | ||
var express = require('express'); | ||
var router = express.Router(); | ||
|
||
// router for index page | ||
router.get('/', function(req, res) { | ||
res.render('index', | ||
{ | ||
title: 'home', | ||
bodyID: 'home' | ||
} | ||
); | ||
}); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// require express and create router | ||
var express = require('express'); | ||
var router = express.Router(); | ||
|
||
// router for /page | ||
router.get('/', function(req, res) { | ||
res.render('page', | ||
{ | ||
title: 'example page', | ||
bodyID: 'page' | ||
} | ||
); | ||
}); | ||
|
||
module.exports = router; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
extend layout | ||
|
||
block content | ||
p This is just a base for a node app using express, jade, and stylus, ok? | ||
p | ||
i Ok. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
doctype html | ||
html(lang="en") | ||
head | ||
title #{title} • express playground | ||
link(rel="stylesheet", href="/css/base.css") | ||
|
||
body(id!="#{bodyID}") | ||
header | ||
h1 express playground | ||
|
||
nav | ||
ul | ||
li | ||
a(href="/") home | ||
li | ||
a(href="/page") example page | ||
|
||
.container | ||
block content | ||
|
||
footer | ||
p | ||
made by | ||
a(href="http://twitter.com/jennschiffer") jenn schiffer | ||
| • | ||
a(href="http://github.com/jennschiffer/express-playground") fork it on githugs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
extend layout | ||
|
||
block content | ||
h2 #{title} | ||
p Here's an example page showcasing express routes. | ||
p | ||
strong Pretty cool. |