-
Book Overview & Buying
-
Table Of Contents
Node Cookbook: Second Edition
By :
Once we have our HTML, we'll want to style it. We could of course use raw CSS, but Express integrates nicely with some select CSS preprocessors.
Stylus is one such engine. It's written with Express in mind, and its syntax follows many of the design principles found in Jade.
In this recipe, we're going to put Stylus in the spotlight, learning how we can use it to apply styles to our profiles table from the previous recipe.
We'll need our nca folder as it was left in the previous recipe.
First, we need to set up our app to use Stylus.
If we were starting a new project, we could use the express executable to generate a Stylus-based Express project as follows:
express -c stylus ourNewAppName
This would generate a project where stylus is a dependency in package.json, with an extra line in app.js in the configuration section:
app.use(require('stylus').middleware(path.join(__dirname,
'public')));However, since we've already got a...
Change the font size
Change margin width
Change background colour