Skip to content

Do not preload CSS if CSS is not added to page #330

@bamadesigner

Description

@bamadesigner

Issue Overview

In testing #319, I discovered an issue.

Basically, there's no co-relation to when print_styles() is used inside a template and what CSS files are pre-loaded. The logic that preloads a CSS file is "hard coded" inside the get_css_files() function.

For example: I could decide I don't want to load the content.css file and remove 'wp-rig-content' from the print_styles() call in the front-page template but the content.min.css file is still pre-loaded because its logic is always set to true in the get_css_files() function.

Describe your environment

Working on v2.0 branch.

Steps to Reproduce

  1. Remove 'wp-rig-content' from the print_styles() call in the front-page template
  2. Look at source code
  3. See that content.min.css is still pre-loaded even though its stylesheet is not loaded on the page.

Expected Behavior

content.min.css should not be pre-loaded if not loaded.

Current Behavior

content.min.css is still pre-loaded even though its stylesheet is not loaded on the page.

Possible Solution

Related Issues and/or PRs

#319

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions