• Resolved Andrea

    (@andreamk)


    Hello
    I have a css file with this line

    @import url ("https://fonts.googleapis.com/css?family=Barlow:300,400");

    that becomes

    @import url (//fonts.googleapis.com/css?family=Barlow:300,400);

    after css processing

    This is a error. External urls in css files should not be changed.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Hi any word on this?

    I am hosting my font files on a CDN and loading them through CSS but it’s also removing the protocol from the URL.

    @font-face{font-family:’Open Sans’;font-style:normal;font-weight:400;src:local(‘Open Sans Regular’),local(‘OpenSans-Regular’),url(//samoha-b9c9.kxcdn.com/wp-content/themes/mesmerize-pro-child/fonts/open-sans-v15-latin-ext_latin-regular.woff2)

    If you post your import or url() in the Critical Path CSS field under the Pro tab, it loads without stripping the protocol.

    Not sure if this is the best way to do it.

    Thread Starter Andrea

    (@andreamk)

    Hi thanks for the reply

    I have css generated with sass and every time I change fonts I should also modify the settings of plugin.

    I tried to select “https force” in the url options but continue to remove https:

    I propose to add an option in url options.
    do nothing that skips the processing of the urls

    Plugin Author Raul P.

    (@alignak)

    Hi, sorry for the late reply.

    While this doesn’t directly reply to your question, using import on css files is considered bad practice.

    I suggest you remove those from the css and properly enqueue those fonts, this way:
    https://www.wpbeginner.com/wp-themes/how-add-google-web-fonts-wordpress-themes/

    That way, you could also use the inline google fonts option, which will speed up the site further.

    As for the protocol being changed, you’re right. It should follow the option of either // http or https, according to the settings. Will fix this in the next version.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘import external url in css file problem’ is closed to new replies.