Update compile.js

from a couple of tests I've made (including placing the directive elements in different ordering and writing the directives in different ordering).