Move directive parsing code to loader from directive

Because loading is the work for loader.