Skip to content

Instantly share code, notes, and snippets.

@mnmly
Created February 7, 2012 01:05
Show Gist options
  • Save mnmly/1756330 to your computer and use it in GitHub Desktop.
Save mnmly/1756330 to your computer and use it in GitHub Desktop.
Getting `500 Error: Invalid arguments passed to 'include' tag. `: integration with express.
express = require("express")
routes = require("./routes")
swig = require('swig')
app = module.exports = express.createServer()
app.configure ->
swig.init
root: __dirname + "/views"
allowErrors: true
app.register('.html', swig)
app.set('view engine', 'html')
app.set 'view options',
layout: no
app.set "views", __dirname + "/views"
app.use express.bodyParser()
app.use express.methodOverride()
app.use app.router
app.use express.static(__dirname + "/public")
app.configure "development", ->
app.use express.errorHandler(
dumpExceptions: true
showStack: true
)
app.configure "production", ->
app.use express.errorHandler()
app.get "/", routes.index
app.listen 3000
console.log "Express server listening on port %d in %s mode", app.address().port, app.settings.env
<html><head>
<title>Error: Invalid arguments passed to 'include' tag.</title>
<style>body {
margin: 0;
padding: 80px 100px;
font: 13px "Helvetica Neue", "Lucida Grande", "Arial";
background: #ECE9E9 -webkit-gradient(linear, 0% 0%, 0% 100%, from(#fff), to(#ECE9E9));
background: #ECE9E9 -moz-linear-gradient(top, #fff, #ECE9E9);
background-repeat: no-repeat;
color: #555;
-webkit-font-smoothing: antialiased;
}
h1, h2, h3 {
margin: 0;
font-size: 22px;
color: #343434;
}
h1 em, h2 em {
padding: 0 5px;
font-weight: normal;
}
h1 {
font-size: 60px;
}
h2 {
margin-top: 10px;
}
h3 {
margin: 5px 0 10px 0;
padding-bottom: 5px;
border-bottom: 1px solid #eee;
font-size: 18px;
}
ul {
margin: 0;
padding: 0;
}
ul li {
margin: 5px 0;
padding: 3px 8px;
list-style: none;
}
ul li:hover {
cursor: pointer;
color: #2e2e2e;
}
ul li .path {
padding-left: 5px;
font-weight: bold;
}
ul li .line {
padding-right: 5px;
font-style: italic;
}
ul li:first-child .path {
padding-left: 0;
}
p {
line-height: 1.5;
}
a {
color: #555;
text-decoration: none;
}
a:hover {
color: #303030;
}
#stacktrace {
margin-top: 15px;
}
.directory h1 {
margin-bottom: 15px;
font-size: 18px;
}
ul#files {
width: 100%;
height: 500px;
}
ul#files li {
padding: 0;
}
ul#files li img {
position: absolute;
top: 5px;
left: 5px;
}
ul#files li a {
position: relative;
display: block;
margin: 1px;
width: 30%;
height: 25px;
line-height: 25px;
text-indent: 8px;
float: left;
border: 1px solid transparent;
-webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;
overflow: hidden;
text-overflow: ellipsis;
}
ul#files li a.icon {
text-indent: 25px;
}
ul#files li a:focus,
ul#files li a:hover {
outline: none;
background: rgba(255,255,255,0.65);
border: 1px solid #ececec;
}
ul#files li a.highlight {
-webkit-transition: background .4s ease-in-out;
background: #ffff4f;
border-color: #E9DC51;
}
#search {
display: block;
position: fixed;
top: 20px;
right: 20px;
width: 90px;
-webkit-transition: width ease 0.2s, opacity ease 0.4s;
-moz-transition: width ease 0.2s, opacity ease 0.4s;
-webkit-border-radius: 32px;
-moz-border-radius: 32px;
-webkit-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03);
-moz-box-shadow: inset 0px 0px 3px rgba(0, 0, 0, 0.25), inset 0px 1px 3px rgba(0, 0, 0, 0.7), 0px 1px 0px rgba(255, 255, 255, 0.03);
-webkit-font-smoothing: antialiased;
text-align: left;
font: 13px "Helvetica Neue", Arial, sans-serif;
padding: 4px 10px;
border: none;
background: transparent;
margin-bottom: 0;
outline: none;
opacity: 0.7;
color: #888;
}
#search:focus {
width: 120px;
opacity: 1.0;
}
</style>
</head>
<body>
<div id="wrapper">
<h1>Express</h1>
<h2><em>500</em> Error: Invalid arguments passed to 'include' tag.</h2>
<ul id="stacktrace"><li> at Object.compile (/Users/mnmly/Development/SimpleHonestWork/2012-node/node_modules/swig/lib/tags.js:34:15)</li><li> at Object.<anonymous> (/Users/mnmly/Development/SimpleHonestWork/2012-node/node_modules/swig/lib/parser.js:360:27)</anonymous></li><li> at Array.forEach (native)</li><li> at Function.<anonymous> (/Users/mnmly/Development/SimpleHonestWork/2012-node/node_modules/swig/node_modules/underscore/underscore.js:76:11)</anonymous></li><li> at Object.compile (/Users/mnmly/Development/SimpleHonestWork/2012-node/node_modules/swig/lib/parser.js:323:7)</li><li> at createTemplate (/Users/mnmly/Development/SimpleHonestWork/2012-node/node_modules/swig/index.js:68:27)</li><li> at getTemplate (/Users/mnmly/Development/SimpleHonestWork/2012-node/node_modules/swig/index.js:108:26)</li><li> at Object.compile (/Users/mnmly/Development/SimpleHonestWork/2012-node/node_modules/swig/index.js:152:16)</li><li> at Function.compile (/Users/mnmly/Development/SimpleHonestWork/2012-node/node_modules/express/lib/view.js:68:33)</li><li> at ServerResponse._render (/Users/mnmly/Development/SimpleHonestWork/2012-node/node_modules/express/lib/view.js:417:18)</li></ul>
</div>
</body></html>
{% extends 'layout.html' %}
{% block main_content %}
sweet
{% endblock %}
<!doctype html>
<!--[if lt IE 7]> <html class="no-js lt-ie9 lt-ie8 lt-ie7" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js lt-ie9 lt-ie8" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js lt-ie9" lang="en"> <![endif]-->
<!--[if gt IE 8]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>2012</title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<script src="/public/js/libs/prefixfree.min.js"></script>
<script src="/public/js/libs/require.js"></script>
<link rel="stylesheet" href="/public/css/style.css">
</head>
<body class="">
{% block main_content %}{% endblock %}
{% include 'footer.html'%}
{{ form }}
</body>
</html>
{
"name": "application-name"
, "version": "0.0.1"
, "private": true
, "dependencies": {
"express": "2.5.7"
, "swig": ">= 0.0.1"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment