Skip to content

Commit

Permalink
Add gw_resources_dir() to get the directory for a specific site
Browse files Browse the repository at this point in the history
  • Loading branch information
scottgonzalez committed Sep 13, 2014
1 parent f7da3c2 commit c534a20
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
22 changes: 21 additions & 1 deletion README.md
Expand Up @@ -14,7 +14,7 @@ Resources are uploaded to `/gw-resources/{HOME_URL}/`. If you'd like a friendlie

If you have problems uploading resources, check the [Permissive Uploads](#permissive-uploads) section.

## API
## Node.js API

For most projects, you should only need to specify the `wordpress` config
and use the `wordpress-deploy` task (or its alias `deploy`).
Expand Down Expand Up @@ -330,6 +330,26 @@ Synchronizes all resources in `path` to the WordPress site.
* `path`: The directory containing resources to synchronize.
* `callback` (`function( error )`): Callback to invoke after synchronizing all resources.

## PHP API

### Constants

#### GW_VERSION

The installed version of grunt-wordpress.

#### GW_RESOURCE_DIR

The path to the resources directory for the current site.

### Methods

#### gw_resources_dir( url )

Gets the resources directory for a specific site.

* `url`: The URL for the site.

## Permissive Uploads

Depending on what resources you're uploading, you may need to change some WordPress settings.
Expand Down
7 changes: 5 additions & 2 deletions grunt-wordpress.php
Expand Up @@ -7,8 +7,11 @@
define( 'GW_VERSION', '1.0.7' );

if ( ! defined( 'GW_RESOURCE_DIR' ) )
define( 'GW_RESOURCE_DIR', dirname( WP_CONTENT_DIR ) . '/gw-resources/' .
preg_replace( '/^\w+:\/\//', '', home_url() ) );
define( 'GW_RESOURCE_DIR', gw_resources_dir( home_url() ) );

function gw_resources_dir( $url ) {
return dirname( WP_CONTENT_DIR ) . '/gw-resources/' . preg_replace( '/^\w+:\/\//', '', $url );
}

function gw_get_version( $args ) {
global $wp_xmlrpc_server;
Expand Down

0 comments on commit c534a20

Please sign in to comment.