Favicon
Lets add a favicon to our application using the connect.favicon
middleware. From a performance perspective, this has some value as we can cache it. Also, your browser will request a favicon even if one does not exist, and this can result in 404 errors being thrown. We will use the existing staticCache
config value to set maxAge
for the favicon. Let's edit the Express server, /vision-web/lib/express/index.js
, and add the favicon
middleware:
app.set('views', 'views'); app.use(express.favicon('public/components/vision/favicon.ico'), { maxAge: config.get('express:staticCache') });
Minification
We can improve page load time by minifying our static assets. We will minify our JavaScript and CSS files by installing the following two grunt tasks:
grunt-contrib-uglify
: This allows you to minify JavaScript files:
npm install grunt-contrib-uglify --save-dev
grunt-contrib-cssmin
: This allows you to minify CSS files:
npm install grunt-contrib-cssmin --save-dev
Let's add these minification tasks...