Reduce duplication in Bootstrap generator.

* Move magic strings into constants.
* Extract layout logic into private method.