Welcome! To use this support forum, please Login or Join Today!

   

Style Sheet Consolidation

{name}
Rank

Total Posts: 20

Joined 2013-12-11

PM

 

Newbie here. I was wondering, on my Mobius theme, since you can copy the main style.css from the parent theme into your child theme versus importing it, do you need to even edit the Style1.css for example, to make changes to the site? Does either deleting the Style1.css or copying that Style1.css code into your child themes main style.css break the site?

I’m asking because I feel like I’m having to jump in between styles sheets too much and maybe there is a way to either remove one or consolidate it.

{name}
RankRankRankRank

Total Posts: 3667

Joined 2011-04-27

PM

 

Hi, Good question, so please forgive my lengthy response :)

...since you can copy the main style.css from the parent theme into your child theme versus importing it, do you need to even edit the Style1.css?

I’ll answer your main question below, but first of all, yes you can copy the parent theme’s style.css into your child theme’s style.css but you wouldn’t get CSS updates if a bug is discovered or if a new visual feature is added.

The parent theme (mobius/style.css) is completely overwritten on update—which is why it is initially @imported by the child theme.

The styles within the parent theme’s style.css are (for the most part) structural. That said, if there are only a few changes you’re making, It might be better to copy and edit those rules within your child theme’s style1.css. Since style1.css is loaded after style.css, those rules would cascade and essentially override those of the parent theme.

This isn’t intended to discourage you from doing whatever you want, but just something to be aware of. If it’s more extensive edits, this may actually be a viable solution.

Does either deleting the Style1.css or copying that Style1.css code into your child themes main style.css break the site?

As you probably know, style1.css is all your complimentary preset colors, font margins, and some basic structural stuff specific to Mobius.

If you place this function in your child theme’s functions.php, it will basically unload (or deregister) style1.css, allowing you to copy the contents of style1.css to your child theme’s main style.css.

// hook onto add_stylesheets() to add or remove stylesheets
function st_remove_preset() {
 //deregisters the preset style
 wp_deregister_style('style');
}
add_filter ('add_stylesheets','st_remove_preset');