I've been working on customizing the background CSS settings for a specific route or page in my Meteor app. To achieve this, I utilized Template.template.rendered/destroyed along with jQuery selectors to inject the desired CSS once the template is rendered. Here's how I did it:
Template.template.rendered = function() {
$('html, body').css({
"background-color": "#fdfdfd",
...additional css properties
};
};
Template.template.destroyed = function() {
$('html, body').css({
"background": "none"
};
};
However, I've noticed that this approach might be causing some slowness issues, especially when navigating back to the page using the browser's back button which results in a frozen page for about 5 seconds. I'm considering exploring other options like utilizing iron-router before/after hooks as a potential solution to address this sluggishness. While I'm not very familiar with these hooks, I believe they might help resolve the browser-related slowdowns I'm experiencing. Are there any alternative methods or suggestions aside from these two approaches? Any insights would be greatly appreciated. Thank you.