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

Only load asset bundle on required controllers/actions #12

Closed
nfourtythree opened this issue Feb 2, 2021 · 2 comments
Closed

Only load asset bundle on required controllers/actions #12

nfourtythree opened this issue Feb 2, 2021 · 2 comments

Comments

@nfourtythree
Copy link

At the moment the asset bundle is being loaded on every control panel request (https://github.com/internetztube/craft-slug-equals-title/blob/master/src/SlugEqualsTitle.php#L31). This is not a good practice as it could cause issues/conflicts with other plugins/assets.

One such issue is in Commerce with the email preview feature: craftcms/commerce#1950

The asset bundle should only be registered/loaded when it is absolutely required.

Either the logic will need updating in the init() method to selectively register the bundle or you could use template hooks for the pages that need the bundle and register them that way.

e.g. {% do view.registerAssetBundle("mynamespace\\FooBundle") %}

@internetztube
Copy link
Owner

Thanks for the report! Will provide a fix later today.

@internetztube
Copy link
Owner

The bug should be fixed with 1.3.1. @mdominguez

composer update internetztube/craft-slug-equals-title

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants