-
Notifications
You must be signed in to change notification settings - Fork 641
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more APIs to manage extensions of environement #512
Conversation
@carljm let me know what you think and if it can be merged into master. I think this PR is not really important for most people, but since extensions can be added, it should be possible to remove these extensions. |
If it is accepted, it would be nice to add a description of these two methods to documentation (http://mozilla.github.io/nunjucks/api.html#environment). Personally, I find these two methods very useful. |
@SamyPesse This looks fine to me. I agree that these methods should be documented. |
getExtension | ||
env.getExtension(name) | ||
Get an extension named **name**. | ||
{% endapi %} | ||
|
||
{% api %} | ||
hasExtension | ||
env.hasExtension(name) | ||
Return true if a custom extension named **name** as been added. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
s/as/has/
LGTM ! |
Looks good, merging. |
Add more APIs to manage extensions of environment.
This is PR is just adding 2 methods to the Environment class:
removeExtension
andhasExtension
.I needed these methods for GitBook, where some “blocks” can be redefined and the previous nunjucks extension needs to be cleanup before.