paulgibbs / achievements

Achievements gamifies your WordPress site with challenges, badges, and points.
http://achievementsapp.com
63 stars 9 forks source link

Remove the dev folders in the build #117

Closed BronsonQuick closed 11 years ago

BronsonQuick commented 11 years ago

Hey Paul,

Firstly, massive props for shipping 3.4 :+1: Great work as always from you!

I saw you popping in Grunt when I woke up this morning and was keen to see where you were at with it. This patch will fix up point number 2 here: https://github.com/paulgibbs/achievements/issues/116

I'm also curious to know how you've got the new folder structure setup on your computer. Have you got a symlink to the src folder in plugins/achievements?

It looks like you could use some watches in Grunt for this as well so I might have a play around now for you to see if I can come up with anything. I've only been using Grunt for about 14 days so I'm a noob too. I've been playing around with a Sennza version of 10up's grunt plugin: https://github.com/sennza/grunt-wp-plugin :grin:

paulgibbs commented 11 years ago

Thanks! :D

For your other question, I have symlinked ~/Sites/achievements/src/ to ~/Sites/example.com/wp-content/plugins/achievements.

And because WordPress and PHP and symlinks don't place nicely, I have a hacks file in mu-plugins that contains this helper to fix paths:

function bbg_fix_plugins_url( $url ) {
    // 7/9/13 achievements hack for symlinks, etc.
    $url = str_replace( 'http://example.com/wp-content/plugins/Users/paul/Sites/achievements/src/', 'http://example.com/wp-content/plugins/achievements/', $url );

    return str_replace( 'Users/paul/Sites/master/wp-content/plugins/', '', $url );  // 1/8/12 - this was prefixed with a /.
}
add_filter( 'plugins_url', 'bbg_fix_plugins_url' );
add_filter( 'dpa_basenname', 'bbg_fix_plugins_url' );
add_filter( 'script_loader_src', 'bbg_fix_plugins_url' );
add_filter( 'style_loader_tag', 'bbg_fix_plugins_url' );