typescript instantiate generic type
function buildObject<T>(type: { new(): T } ): T {
return new type();
}
starting out with facebook flow
npm install flow-bin
./node_modules/flow-bin/vendor/flow init
./node_modules/flow-bin/vendor/flow
Example app can be viewed here
custom npm scripts
You can define your own scripts in package.json, like:
"scripts": {
"fix-tags": "node app.js tags/index.html"
}
and you can run them like this:
npm run-script fix-tags
install bower components on heroku build
Make sure you have bower added as a dependency in package.json, and then add the following script as postinstall:
"scripts": {
"postinstall": "./node_modules/bower/bin/bower install"
}
asset digest in node.js
node-static-asset can help with this.
Like the docs say, add this to your app:
var express = require('express');
var app = express();
var staticAsset = require('static-asset');
app.use(staticAsset(__dirname + "/public/") );
app.use(express.static(__dirname + "/public/") );
And then in the view, use it like this:
script(type="text/javascript", src=assetFingerprint("/javascripts/jquery.min.js") )