Refactor esp generator for components
Update doc
Externalize esp templates