osompress / genesis-portfolio-pro

Plugin: Genesis Portfolio Pro
24 stars 14 forks source link

Find a way to move from plugin.php to <plugin-name>.php #23

Closed marksabbath closed 6 years ago

marksabbath commented 6 years ago

We would need to research how to move from plugin.php to <plugin-name>.php since just moving the file would break installs that are being updated via WordPress dashboard.

nickcernis commented 6 years ago

@marksabbath I agree with @nathanrice's sentiment at https://github.com/copyblogger/genesis-portfolio-pro/issues/22#issuecomment-411446281, and think we should consider:

The downsides of this approach might be:

If we need to include [plugin-slug.php] inside plugin.php to make Grunt tasks more consistent, that seems worthwhile, but otherwise we could just keep plugin.php.

marksabbath commented 6 years ago

Hey, @nickcernis

Yes, I think that this should be our approach from now. New plugins should definitely follow the name conventions defined here.

  • Using plugin.php for all existing plugins that already have that file.
  • Using [plugin-slug].php for new plugins.

Yeap, unfortunately, we will not be able to move from plugin.php to [plugin-slug].php unless we find a way to clean that file up before updating the plugin via dashboard. I'll need to research about that since nothing comes up on my mind.

  • We can't use the nicer [plugin-slug].php convention across all plugins.

I have added a new variable inside package.json, labeled main_plugin_file where we could define the name of the main plugin file. So inside the Gruntfile.js, we just update <%= pkg.name %> to <%= pkg.main_plugin_file %>. What is your oppinion about this approach?

  • We have to adapt Grunt tasks to target the correct file, instead of using the <%= pkg.name %>

IMHO it totally worth and we should add the file [plugin-slug].php.

If we need to include [plugin-slug.php] inside plugin.php to make Grunt tasks more consistent, that seems worthwhile, but otherwise we could just keep plugin.php.

nickcernis commented 6 years ago

I have added a new variable inside package.json, labeled main_plugin_file where we could define the name of the main plugin file. So inside the Gruntfile.js, we just update <%= pkg.name %> to <%= pkg.main_plugin_file %>. What is your oppinion about this approach?

That sounds good to me. We'll just need to make sure the header stays in plugin.php (and no header is present in [plugin-slug].php.

nickcernis commented 6 years ago

Work on this was completed by Marcos in https://github.com/studiopress/genesis-portfolio-pro/pull/32.