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
Showing
10 changed files
with
148 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,69 @@ | ||
var tobi = require('tobi'), | ||
express = require('express'), | ||
resmin = require('../index.js'), | ||
app = express.createServer(); | ||
|
||
var resminConfig = { | ||
js: { | ||
"all": [ | ||
"//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js", | ||
"//ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js", | ||
"/js/foo.js", | ||
"/js/bar.js", | ||
"/js/baz.js" | ||
] | ||
}, | ||
css: { | ||
"all": [ | ||
"//fonts.googleapis.com/css?family=Indie+Flower:regular&v1", | ||
"//fonts.googleapis.com/css?family=Inconsolata:regular&v1", | ||
"/css/foo.css", | ||
"/css/bar.css", | ||
"/css/baz.less" | ||
] | ||
} | ||
}; | ||
|
||
app.configure(function(){ | ||
app.use(express.logger()); | ||
app.use(express.bodyParser()); | ||
app.set('views', __dirname + '/views'); | ||
app.set('view engine', 'jade'); | ||
resminConfig.merge = true; | ||
resminConfig.minify = true; | ||
resminConfig.gzip = true; | ||
app.use(resmin.middleware(__dirname + '/public', resminConfig)); | ||
}); | ||
|
||
app.dynamicHelpers(resmin.dynamicHelper); | ||
|
||
app.get('/', function(req, res) { | ||
res.render('index'); | ||
}); | ||
|
||
var browser = tobi.createBrowser(app); | ||
browser.get('/', function(res, $){ | ||
res.should.have.status(200); | ||
res.should.not.have.status(500); | ||
res.should.have.header('Content-Type', 'text/html; charset=utf-8'); | ||
|
||
var css = $("ul.css"), | ||
js = $("ul.js"); | ||
|
||
css.should.have.many('li'); | ||
js.should.have.many('li'); | ||
|
||
console.log("CSS files:"); | ||
css.find("li").each(function(i,elm){ | ||
console.log(elm.innerHTML); | ||
}); | ||
|
||
console.log("JavaScript files:"); | ||
js.find("li").each(function(i,elm){ | ||
console.log(elm.innerHTML); | ||
}); | ||
|
||
console.log("All tests passed!"); | ||
|
||
app.close(); | ||
}); |
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 @@ | ||
{ | ||
"name" : "resmin-tests", | ||
"version" : "0.0.1", | ||
"author" : "Marcus Ekwall", | ||
"description" : "Test suite for resmin", | ||
"homepage" : "https://github.com/mekwall/node-resmin", | ||
"repository": { | ||
"type": "git", | ||
"url": "git://github.com/mekwall/node-resmin.git" | ||
}, | ||
"engines" : { "node" : ">= 0.4.x" }, | ||
"main" : "./app.js", | ||
"dependencies" : { | ||
"express": ">= 2.4.2", | ||
"jade": ">= 0.12.4", | ||
"tobi": ">= 0.3.0", | ||
"less": ">= 1.1.2", | ||
"zombie": ">= 0.0.1" | ||
} | ||
} |
Empty file.
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,23 @@ | ||
@color: #4D926F; | ||
|
||
#header { | ||
color: @color; | ||
} | ||
|
||
h2 { | ||
color: @color; | ||
} | ||
|
||
.rounded-corners (@radius: 5px) { | ||
border-radius: @radius; | ||
-webkit-border-radius: @radius; | ||
-moz-border-radius: @radius; | ||
} | ||
|
||
#header { | ||
.rounded-corners; | ||
} | ||
|
||
#footer { | ||
.rounded-corners(10px); | ||
} |
Empty file.
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,8 @@ | ||
var hello; | ||
var world; | ||
var one; | ||
var two; | ||
var three; | ||
function bar (alpha, beta, gamma) { | ||
console.log("Hello world!"); | ||
} |
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,5 @@ | ||
(function(){ | ||
function baz () { | ||
console.log("Hello world!"); | ||
} | ||
})(); |
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,3 @@ | ||
function foo () { | ||
console.log("Hello world!"); | ||
} |
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,9 @@ | ||
h1 Hello world! | ||
|
||
ul.css | ||
- each url in resmin.css.all | ||
li= url | ||
|
||
ul.js | ||
- each url in resmin.js.all | ||
li= url |
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,11 @@ | ||
!!! 5 | ||
html | ||
head | ||
title resmin test suite | ||
//- Stylesheets | ||
- each url in resmin.css.all | ||
link(rel='stylesheet', href=url) | ||
//- Scripts | ||
- each url in resmin.js.all | ||
script(src=url) | ||
body!= body |