full flatten for statics map
transform roles middleware in modes middleware
clean html middleware