CMS Development

Matthias79
Member | Platinum Partner
Member | Platinum Partner

Insert minified css in external website

Hello Community,

 

i have a problem when changing my main style.css file.

On an external wordpress website i inserted the hubspot minified css file. But even after weeks, it dont actualize. I made many time changes and published. But it dont work.

Is there something wrong with binding the min.css file?

I am using CTAs on this wordpress website and dont want to define for each CTA the styles inline. I created some classes in my main css file and want to load this in the head of my wordpress website.

Thanks for any advices and help to solve this problem.

 

Kind regards

Matthias

0 Upvotes
2 Replies 2
Mike_Eastwood
Key Advisor | Gold Partner
Key Advisor | Gold Partner

Insert minified css in external website

Hi @Matthias79 

 

I recommend you add all the CSS styles to your WordPress stylesheet. There you can minify, cache and distribute the stylesheet on a CDN (Content Distribution Network).

 

It's difficult (if not impossible) to target anything that loads in an iFrame - in which case your inline styles would work (even though it's not ideal).

 

With CSS - specificity overrides the rules so a more specific rule:

 

.page-style .div-style button {
color: #FF9900;
}

would override a less specific rule:

 

.div-style button {
    color: #FF9900;
}

Hope this helps

-Mike

Matthias79
Member | Platinum Partner
Member | Platinum Partner

Insert minified css in external website

Hi @Mike_Eastwood ,

thanks for ur answer. The recommendation is wrong. I want to load a minified version of the hubspot style.css in my wordpress website.

Like the hubspot style css min is loaded on my landingpages in hubspot.

Because i want to use the stylesheet in there in my wordpress site.

Let me go a little bit deeper in this.

At the moment i have in the cta's stylesheets defined special for each CTA. ITs working well when i add this CTAs in my Wordpress, because the styles are there inline.

But when i want to change the style of all my CTAs lets say because of a new CI/CD, i have to edit all my CTAs.

 

To not face that problem, i want to add my styles in my main.css file in hubspot and load the minified version of that in my wordpress page.
Then all the inline styles of my CTAs are not needed anymore and when i wanna change, i only do in the main.css file and it will change also in the wordpress site.

 

Can i do that? I tried, but seems that the minified css file is not actualizing.

 

Kind regards

Matthias

0 Upvotes