We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Duplicate assets this->assets->addJs and css

Hi!!! If i use in index controller in initialize() $this->assets->addCss() for add styles and scripts And in other controller use in initialize() $this->assets->addCss(), then return $this->dispatcher->forward(index/index)

in view duplicate assets from index controller and other.

Is it possible to clean or remove additives assets?

Thank you? brothers!

This post: https://forum.phalcon.io/discussion/7159/preventing-duplicate-assets shows a way to do it by adding an attribute to your controller.



14.4k

Check for resources of the first controller. But I need to insert the resources of the second. And remoove first resources. How to contact the developers to add the "clean" method for assets. It's not difficult ... but a very necessary thing.....

Where do you determine when to forward a request to your IndexController? That would be the spot where you leave out the assets of your first controller with an if-else.

As for contacting the devs, I'd say Github is the place to go. Create an issue there and if they agree they will implement it. I agree 'clean' or 'reset' method would be nice to have but I believe you can work around it for the time being with what I mentioned above.