Skip to content

Failed to guess the relative scripts/styles paths in WP subfolder installs #34

@nash-ye

Description

@nash-ye

This is something I notice while I am working on PR #31 , WordPress register most of their scripts/styles that included in wp-includes folder with relative paths.

So a script like comment-reply can't be optimized successfully, when I dig more into this it seems that our way of guessing the URL/Path is wrong.

see this codes:

        $has_host = (bool) parse_url( $src, PHP_URL_HOST );
        if ( ! $has_host ) {
          $src = 'http://' . $host_domain . $src;
        } 

and

        // First attempt to get the file from the filesystem
        $contents = false;
        $is_self_hosted = self::is_self_hosted_src( $src );
        if ( $is_self_hosted ) {
          $src_abspath = ABSPATH . parse_url( $src, PHP_URL_PATH );
          $contents = file_get_contents( $src_abspath );
        } 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions