• Resolved Guido

    (@guido07111975)


    Hi,

    I want to include a minified CSS file in my plugin tot reduce page load. And to please Google Pagespeed Insights.

    But I’v added some comments in my current CSS file, and those should be removed when minifying the CSS. But I want to keep the comments.

    Should I enqueue the minified CSS file only, or should I enqueue both original CSS file and minified CSS file?
    In that case browser can decide which file to load. And I don’t have to remove the comments from the original CSS file.

    Guido

Viewing 3 replies - 1 through 3 (of 3 total)
  • In that case browser can decide which file to load. And I don’t have to remove the comments from the original CSS file.

    The browser doesn’t decide which to load. That’s not how minification works. It’ll only load which stylesheet you tell it to load.

    A common practice for situations like this is to enqueue the minified stylesheet, but include the original stylesheet in the plugin, for reference.

    Thread Starter Guido

    (@guido07111975)

    I fully understand now; just leave the original file in plugin folder for reference. Thanks!

    I do not think you can keep it as you thought.
    You can try this one https://cssminifier.org/

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

The topic ‘Using minified CSS file in plugin’ is closed to new replies.