Use preprocess to create constants.js

@nchapman - this is a straw man and still needs lots of work!