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

Keep different versions of the compiled/merged CSS / JS file #5265

Open
tsteur opened this issue May 30, 2014 · 3 comments
Open

Keep different versions of the compiled/merged CSS / JS file #5265

tsteur opened this issue May 30, 2014 · 3 comments
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.

Comments

@tsteur
Copy link
Member

tsteur commented May 30, 2014

As soon as the stylesheets vary depending on user permissions or settings the CSS and/or JS has to be recompiled very often under circumstances.

Example:

if (Piwik::hasUserSuperUserAccess()) {
 $stylesheets[] = "libs/jquery/stylesheets/jquery.jscrollpane.css";
}
if ($setting->isEnabled()) {
 $stylesheets[] = "libs/jquery/stylesheets/jquery.jscrollpane.css";
}

Imagine there are multiple users active and all of them have different permissions and/or settings and/or ... For each request we might have to recompile the CSS / JS as the registered stylesheets / jsFiles are different for each user.

This was for instance the case in #5212 but solved with a "workaround". Nonetheless we (or plugin developers) might face this problem again or have already resulting in slow speed from time to time.

As a plugin developer I would not be aware of such an impact when adding files depending on different permissions etc. Plugin developers would probably also not be able to reproduce this behavior as it only happens if there are multiple active users on a Piwik instance.

Maybe we can keep different versions of the merged files depending on the CacheBuster value. For example instead of only one asset_manager_global_css.css we have asset_manager_global_css_$CACHE_BUSTER_HASH.css. Not sure about side effects etc. There might be better solutions.

@mattab
Copy link
Member

mattab commented May 30, 2014

Increasing priority.

Maybe we should not support or use any conditional CSS or javascript, and always include all CSS and Javascript?

So one solution could be, to remove the hooks:

  • 'AssetManager.getStylesheetFiles'
  • 'AssetManager.getJavaScriptFiles'

and developer could only define CSS and JS assets in the plugin.json.
Then they won't be able to conditionally include assets. This would fix it. What do you think?

@tsteur
Copy link
Member Author

tsteur commented May 30, 2014

I think it makes sense to add different CSS/JS files to different ranges of users. Especially JS. Makes many things much easier.

@mattab
Copy link
Member

mattab commented Jun 20, 2014

Moving away from current backlog as it is a feature request. feel free to move back in, if this issue becomes more pressing.

@tsteur tsteur added this to the 2.x - The Great Piwik 2.x Backlog milestone Jul 8, 2014
@mattab mattab removed the c: Core label Aug 3, 2014
@mattab mattab added this to the Long term milestone Aug 3, 2014
@mattab mattab modified the milestones: Long term, Mid term Dec 23, 2015
@mattab mattab added duplicate For issues that already existed in our issue tracker and were reported previously. and removed Major Indicates the severity or impact or benefit of an issue is much higher than normal but not critical. labels Dec 5, 2016
@mattab mattab modified the milestones: Long term, Mid term Dec 5, 2016
@mattab mattab removed the duplicate For issues that already existed in our issue tracker and were reported previously. label Dec 5, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement For new feature suggestions that enhance Matomo's capabilities or add a new report, new API etc.
Projects
None yet
Development

No branches or pull requests

2 participants