1) How do I make my index.html page link to my CSS (*css/style.css*) file? Ok so this is more of an html question than a node question. But to answer your question, you can do something like this in your index.html file:
<link rel="stylesheet" href="static/bootstrap/css/bootstrap.min.css"> This links a css stylesheet to your page, requesting the file from your server. It is up to your server to then serve this file. 2) Should I be using a pre-processor CSS engine like Stylus/Less?...and if so is there a good example I can download and learn from? The posts out there don't seem to be helping me at the moment. Depends. CSS pre-processors are a great tool to extend CSS, but you don't necessarily need it. As far as implementing this, I have a minimal router in the following project that implements serving static files that you can take a look at. http://kennethkoontz.github.com/mold/ On Mon, May 7, 2012 at 11:59 AM, Flexpadawan <flexpada...@gmail.com> wrote: > Hi All, > > Newbie here so I'll do my best. I've spent the last two says trying to > figure out how to link my index.html page to my CSS file. There are a > couple of "Examples" out there but none of them worked for me, and of > course others have posted comments back as to why their approach is the > wrong way etc. So I have no idea what is the best practice is to order up > a CSS file....and get it to work! I do want to learn to do it the right > way but I need some guidance. > > Here is my starting file below. I guess my question is two part. 1) How > do I make my index.html page link to my CSS (*css/style.css*) file? 2) > Should I be using a pre-processor CSS engine like Stylus/Less?...and if so > is there a good example I can download and learn from? The posts out there > don't seem to be helping me at the moment. > > Environment: > Ubuntu Server 11.1 > Node 0.6.15 > > > > // Require Dependencies > var app = require('http').createServer(handler) > , fs = require('fs') > , io = require('socket.io').listen(app); > > // Server on ( localhost:8000 ) > app.listen(8000); > > // Load up index.html page > function handler(req, res) { > > fs.readFile(__dirname + '/index.html', function(err, data) { > if(err) { > console.log(err); > res.writeHead(500); > return res.end('Error loading index.html'); > } > else { > res.writeHead(200, { 'Content-Type': 'text/html' }); > res.end(data, 'utf-8'); > } > }); > } > > The one thought that does come to mind, architecturally speaking, there > must be a way to serve the CSS file once and have the file referenced from > cache instead of being sent on every hit. > > Thanks in advance! > Flex > > -- > Job Board: http://jobs.nodejs.org/ > Posting guidelines: > https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines > You received this message because you are subscribed to the Google > Groups "nodejs" group. > To post to this group, send email to nodejs@googlegroups.com > To unsubscribe from this group, send email to > nodejs+unsubscr...@googlegroups.com > For more options, visit this group at > http://groups.google.com/group/nodejs?hl=en?hl=en > -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en