kasparsd / minit

A WordPress plugin to combine CSS and Javascript files.
GNU General Public License v2.0
286 stars 46 forks source link

Support custom WP_CONTENT_DIR locations #93

Closed kasparsd closed 7 years ago

szepeviktor commented 7 years ago

@markoheijnen wrote

        $full_path = str_replace( WPMU_PLUGIN_URL, WPMU_PLUGIN_DIR, $url );
        $full_path = str_replace( plugins_url(), WP_PLUGIN_DIR, $full_path );
        $full_path = str_replace( get_theme_root_uri(), get_theme_root(), $full_path );
        $full_path = str_replace( content_url(), WP_CONTENT_DIR, $full_path );
kasparsd commented 7 years ago

I hope we can find a more simple way of doing the same thing. This would need a lot of inline comments to understand what it actually does :)

szepeviktor commented 7 years ago
  1. Replace MU plugin URL-s
  2. Replace plugin URL-s
  3. Replace theme URL-s
  4. Replace remaining /wp-content URL-s

"Replace" may be understood as find files based on URL-s

szepeviktor commented 7 years ago

@kasparsd May I advance the solution for this? Please advise.

szepeviktor commented 7 years ago

I'd favor a solution which moves local path determination to a filter. https://github.com/kasparsd/minit/blob/master/include/minit-assets.php#L103-L104

Would you merge it?

Then I would hook into that.

kasparsd commented 7 years ago

@szepeviktor How about filtering the output of get_asset_relative_path() instead? It would have to return the part after ABSPATH.

szepeviktor commented 7 years ago

The base of the problem is that my wp-content is not below ABSPATH, they are sibling directories.

wp-cli.yml
$DOCROOT/─┬─index.php (modified)
          ├─wp-config.php
          ├─wp-login.php (trap)
          ├─xmlrpc.php (trap)
          ├─ABSPATH/─┬─index.php
          │          ├─wp-load.php
          │          ├─wp-login.php
          │          ├─wp-admin/
          │          └─wp-includes/
          └─static/ (wp-content)

The purpose is to have a clean WordPress core directory.

szepeviktor commented 7 years ago

@kasparsd Please comment on #95

szepeviktor commented 7 years ago

@kasparsd Please close this one.

kasparsd commented 7 years ago

Fixed in #95