Monday, December 12, 2016

Stylish CSS solution and explanations

var express = require('express')
var app = express();
var stylus = require('stylus') //sylus is yet another CSS preprocessor, written this time for Node
var STATIC_DIR = process.argv[3] // static files hold scripts, css files, etc - here the lesson is sending a request that contains one of these - the goal is convert it to regular CSS


app.use(stylus.middleware(STATIC_DIR))//ok app, I don't want to just write normal ole css, I'm fancy. I want to write stylus 
//instead 'cause it gives me all sorts of cool extra tools to keep my css code nice and tidy. 
app.use(express.static(STATIC_DIR))//I've let you know I want to use stylus, now when you're in the middle of firing up my app, 
//before you consider everything good to go, take a look around, find all my stylus files and convert them into normal css so 
//the browsers can understand them


app.listen(process.argv[2]) //OK to get the ball rolling listen for requests on this port

No comments:

Post a Comment