I am new to node, express, stylus, ejs (the whole bundle) and am having trouble getting stylus to work.
I have a directory that contains:
app.js
public/main.styl
views/index.ejs
Here is my app.js code:
var express = require('express');
var app = express();
var stylus = require('stylus');
app.configure(function(){
app.use(stylus.middleware({ src: __dirname + '/public' }));
});
app.get('/', function(req, res){
res.render("index.ejs");
});
app.listen(80);
When I go to localhost my index.ejs file has rendered but it doesn't contain any style. Any ideas what I might be doing wrong? Are there any good tutorials for getting started with stylus? Apologies if this is too vague. Thanks!
Make sure that the URL in the <link>
for your stylesheet is "/main.css" and not "public/main.css" or anything like that; otherwise stylus will actually be looking for public/public/main.styl.