load javascript and stylesheets in beforeLayout()