Rewrite attachments directives and make them work as isolated components.