Totally Zenned
- Join Date:
- Jan 2015
- Posts:
- 824
- Plugin Contributions:
- 0
Encapsulated plugins "any ideas"
I’m currently updating the css for my responsive redesign template, and I’ve run into an interesting issue with the newer encapsulated plugins.
One of my goals with this redesign was to remove all of the !important declarations from my stylesheet which has been successfully completed.. I’ve had some feedback that using !important is generally considered bad practice, especially when you’re building a template, and I don’t disagree with that.
However, the newer encapsulated plugins seem to create a situation where using !important is sometimes unavoidable.
With an encapsulated plugin, you can run into situations where the plugin’s CSS takes precedence over the template’s styles. When that happens, the only reliable way I’ve found to override a particular style is to add !important to my own CSS rule.
That puts template developers in a difficult position. On one hand, we’re encouraged to avoid !important because it can make CSS harder to maintain and override later. On the other hand, the current override system can effectively force us to use it when working with encapsulated plugins.
I’m not a fan of that approach. It feels like the system is forcing developers to use a CSS technique that we generally try to avoid.
This is the main issue I’m running into with the override system: whenever I need to make a CSS adjustment to an encapsulated plugin, the only way to reliably get that change implemented is often to add !important to the specific style.
I’d be interested in hearing how other developers are handling this. Is there a better way to override encapsulated plugin styles without resorting to !important, or is this currently an unavoidable limitation of the system?