- This topic has 9 replies, 4 voices, and was last updated 8 years, 1 month ago by
Tom.
-
AuthorPosts
-
February 17, 2015 at 6:44 am #75925
Pete
Is this GP’s doing?
<style id='generate-style-inline-css' type='text/css
‘>February 17, 2015 at 9:39 am #75967Tom
Lead DeveloperLead DeveloperSure is.
The CSS in the
<head>
section of the site is generated by the options you choose in the Customizer.CSS isn’t a dynamic language, so you can’t call the values from the Customizer to a regular stylesheet (I wish).
Options:
a) Use PHP to create a dynamic stylesheet and include it.
Positives: No inline style in the source
Negatives: Performance takes a pretty decent hit – the server has to create the dynamic stylesheet on every single page load, using server resources and causing longer load times.b) Include the CSS in the
<head>
.Positives: The CSS is read and cached by the browser. Browser doesn’t need to load an external stylesheet. Best option performance-wise.
Negatives: Makes the source look messy.I figure overall performance is more important than code appearance, so I went with option b.
If a third option is revealed that allows me to add it to an external file and not hurt performance, I’ll absolutely make the switch ๐
February 17, 2015 at 9:42 am #75970Pete
Thanks Tom (there’s a lot of css in them thar hills!)
February 17, 2015 at 9:48 am #75971Tom
Lead DeveloperLead DeveloperI know! Luckily it actually has less performance issues than linking to a regular stylesheet – so it’s not actually a bad thing, it just looks a little messy.
Once I find a good solution, I’ll definitely implement it ๐
February 17, 2015 at 12:37 pm #76057Christian Zumbrunnen
An option might be to make it possible to export all the options (or certain parts) to css-Code that can be manuylly added to the (child-) themes css.
Just a thought.February 17, 2015 at 5:47 pm #76089Tom
Lead DeveloperLead DeveloperYea that would work – I would have to provide a function to remove the CSS from the
<head>
in that case.If you were adding it to your existing child theme style.css, it would be good, but if you were creating a new file for it, it would actually perform worse because the browser would have to load a resource from a URL instead of having it right in the
<head>
.March 1, 2015 at 3:04 pm #81653Will
I’ve just started looking at GeneratePress in depth and I’m using the GP Premium add-ons.
Is there a way of specifying different padding for the desktop and mobile versions. For example, desktop content looks nice with element spacing of 40px, but on a small mobile this is much too large. I know I can use media queries, but I’ve just noticed all the Customizer specifications are written inline in the head, under
<style id=’generate-style-inline-css’ type=’text/css’>Will a child theme be applied after these values? Is there any provision anywhere else for different mobile and desktop values?
March 1, 2015 at 11:48 pm #81767Tom
Lead DeveloperLead DeveloperYour child theme CSS will show up after the parent CSS, so you simply need to use media queries in your child style.css file:
@media screen and (max-width: 768px) { /* mobile CSS in here */ }
August 3, 2015 at 11:35 pm #126194ashutosh
Hi,
I want to change these styles from code, which file should i target to achieve same.August 4, 2015 at 12:01 am #126204Tom
Lead DeveloperLead DeveloperHi there,
The styles in the
<head>
are generated by GP and can’t be changed unless you’re using the Customizer options.Instead, you can overwrite that CSS by adding your own CSS into your child theme, or one of these options: https://generatepress.com/knowledgebase/adding-css/
Also, for anyone who wants to remove the block of CSS from the
section, this plugin does a great job of placing it into a file: https://en-ca.wordpress.org/plugins/autoptimize/ -
AuthorPosts
- You must be logged in to reply to this topic.