replace directives with external variable