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

Problem with page-specific JS assetbundles #23

Closed
sergeantjonas opened this issue May 20, 2015 · 2 comments
Closed

Problem with page-specific JS assetbundles #23

sergeantjonas opened this issue May 20, 2015 · 2 comments

Comments

@sergeantjonas
Copy link

I have been implementing PJAX using the yii2-pjax plugin quite successfully. I'm using it to only load the content on my page and keep the header and sidebar static, saving quite a few seconds on not having to reload the assets added to the header and the sidebar.

However, on some of my pages I'm using certain asset bundles to load in javascript only applied to those pages. When loading in the content with pjax these asset bundles are not being registered as I expected they would be. I'm wondering if there is any way to do what I want to do or if the only solution is to add a global javascript file that includes all functions? I would rather not do this as this might create quite a big file and a lot of unused code on certain pages.

This is how I've defined my content:

    <?php Pjax::begin() ?>
         AdminAsset::register($this);
         // Content here
    <?php Pjax::end() ?>

I've looked for the majority of the day and can't find a clean solution besides having one big application.js file or using inline javascript, both of which I would like to avoid.

@SilverFire
Copy link
Member

Duplicates yiisoft/yii2#3680
Duplicates yiisoft/yii2#4814
Duplicates yiisoft/yii2#8540
Duplicates yiisoft/yii2#8916
Duplicates yiisoft/yii2#8702

@SilverFire
Copy link
Member

Should be fixed by #30

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

3 participants