• Good Day!
    I have a question:
    Is it possible exclude an inline css code for a specific css file?
    I have on my website a common css string called “media” that i want to exclude in the style.css file… but this string is used also in a lot of other css files. If I write “media” in the form for exclude css, then autoptimize exclude all the css file that have the string media inside… but I want exclude media only for the style.css.
    My question is: Is there a way to specific from which file i can exclude the specific string?
    i don’t know Style.css?media or media@style.css

    let me know, thank you!
    Regards
    Rosario

    https://wordpress.org/plugins/autoptimize/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Frank Goossens

    (@futtta)

    hmmm, I would try to be a bit more specific; assuming for example your inline code is something like;

    @media (max-width: 600px) {
      .facet_sidebar {
        display: none;
      }
    }

    you could try to exclude with “@media” or “@media (max-width: 600px)”?

    Thread Starter roscus79

    (@roscus79)

    cusenzamarmi in homepage the 3 banners under the slider are broken (and also in contatti page the icons are not well shown)

    Plugin Author Frank Goossens

    (@futtta)

    sorry, afraid you lost me there; are you still talking about the CSS exclusions, or is that a separate question?

    Thread Starter roscus79

    (@roscus79)

    always css exclusions… I posted my website for show the problem that i have… you can see the source and search for #banner0 or #banner1 or #banner2 and see @media

    Plugin Author Frank Goossens

    (@futtta)

    OK, had a look and the problem is that you (probably) excluded bootstrap.css from optimization. This means that, whereas without optimization your style.css is loaded after bootstrap.css, now the optimized CSS that contains the style.css code is loaded before bootstrap.

    There are several possible solutions to this problem;

    • mark the appropriate rules in your style.css as !important, e.g.
      .input-prepend .add-on {
        background: none repeat scroll 0% 0% transparent !important;
        border: 0px none !important;
      }
    • do not exclude bootstrap.css from optimization (but you might have had other reasons for doing so)
    • change the place where the optimized style is inserted, using the API, by using (in your child theme’s functions.php) e.g.;
      add_filter('autoptimize_filter_css_replacetag','roscus_ao_override_css_replacetag',10,1);
      function roscus_ao_override_css_replacetag($replacetag) {
      	return array("</head>","before");
      	}

    Hope this helps,
    frank

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘exclude a "common" inline css code for a specific css file’ is closed to new replies.