understrap / understrap-child

The starter child theme for Understrap, the renowned open-source WordPress starter theme.
GNU General Public License v3.0
582 stars 332 forks source link

Refactored _contact-form7.scss #304

Closed alexbogias closed 1 year ago

alexbogias commented 3 years ago

This change saves around 50kb of minified css

0dp commented 3 years ago

A :not selector, of course

alexbogias commented 3 years ago

It maybe breaks the :focus state... Give me some time to check...

bacoords commented 3 years ago

@alexbogias Have you looked at this again?

alexbogias commented 3 years ago

Yeah I think that it breaks the :hover and :disabled states :( Anyway 50k compiled css it's huge for this imo

0dp commented 3 years ago

I agree 50kb is huge. Especially for something that might not be used for a project!

I'm gonna say something controversial.

Why not leave it as it was, then comment the import of the file. And let it be up to devs to enable contact-form7 support.

As a matter of fact, do the same for woocommers, font-awesome etc.

bacoords commented 3 years ago

I agree as well, Contact Form 7 support doesn't seem as useful as it once was. I would hate to drop support on it though for existing users (if you're a dev trying to optimize a site, you can comment it out yourself, like we do on most of our sites).

I looked through CF7 to see if we could do an opposite approach (add the form-control class to the output via a php filter), but it doesn't seem like that filter exists.

I would be interested in doing something similar to how we load php conditionally for Woocommerce. We could generate a separate CSS file for CF7 and only load it if the plugin is active...?

alexbogias commented 3 years ago

Yeah adding the class with a filter would be much better imo