Skip to content
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 adding view environments #193

Merged
merged 3 commits into from
Jun 26, 2018
Merged

Conversation

josephmancuso
Copy link
Member

This PR adds a new add_environment method onto the view class. this can be used to add Jinja2 environments to the code. Useful for packages that want to expand templates and supports better Masonite package to Masonite applications relationships.

This PR also adds significant improvements to how packages are structured after finally finding the documentation on Jinja2 loaders.

The new code can be used like so:

def boot(self, ViewClass):
     ViewClass.add_environment('dashboard/templates')

This will default to the Jinja2 PackageLoder. You can specify the loader explicitly:

from Jinja2 import FileSystemLoader
def boot(self, ViewClass):
     ViewClass.add_environment('dashboard/templates', loader=FileSystemLoader)

Many other minor tweaks to how Jinja2 environments are built

@josephmancuso josephmancuso added the next minor Issue scheduled for the next minor release label Jun 26, 2018
@josephmancuso josephmancuso self-assigned this Jun 26, 2018
@josephmancuso josephmancuso merged commit c2ae57b into master Jun 26, 2018
@josephmancuso josephmancuso deleted the add-adding-view-environments branch June 29, 2018 18:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
next minor Issue scheduled for the next minor release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant