add onCompile hook and writeAsset flag

we use the onCompile hook to pass in the asset instance and the
writeAsset flag if we want to write the default asset or not