xwp / wp-dependency-minification

Dependency Minification plugin for WordPress
http://wordpress.org/plugins/dependency-minification/
52 stars 10 forks source link

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

Closed nash-ye closed 10 years ago

nash-ye commented 11 years ago

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 );
        } 
nash-ye commented 10 years ago

I think this issue is ready to go!

westonruter commented 10 years ago

@nash-ye awesome! Could you open a PR to the x-team/develop branch?

nash-ye commented 10 years ago

@westonruter done :+1:

westonruter commented 10 years ago

Released in v0.9.7: http://wordpress.org/plugins/dependency-minification/