Skip to content

Instantly share code, notes, and snippets.

@dotherightthing
Last active August 15, 2019 15:17
Show Gist options
  • Save dotherightthing/bdd3c8fd1760373a052894f94e5f5d81 to your computer and use it in GitHub Desktop.
Save dotherightthing/bdd3c8fd1760373a052894f94e5f5d81 to your computer and use it in GitHub Desktop.
[Bundling theme dependencies] #wordpress #tgmpa

Bundling theme dependencies

Created: 2017.03.31

The Composer way is to specify dependencies in composer.json and composer.lock files. Dependencies are then installed via Composer when deploying or working on the site.

The author of this post describes himself as:

... a full-stack web developer who's trying to drag WordPress into 2017 and help people modernize their development workflow.

I appreciate that Composer is an established dependency management system, but that doesn't mean that it's a good fit for WordPress.

The 'WordPress' way

The well-established WordPress way is to use the built-in updating mechanism.

The TGM Plugin Activation PHP class integrates with WordPress to allow users to install dependencies - or not - depending on what they need or prefer.

And it's not just limited to WordPress plugins either. It can also install plugins from a public repository or other source (but it is limited to plugins, although one could possibly build a plugin which wraps Bower dependencies).

From what I know so far, I prefer the WordPress way, because it doesn't overcomplicate things or force a certain software development paradigm onto an established WordPress workflow. In other words, it's not a new way just for the sake of having a new way - that some developers prefer.

TGM Plugin options

TGM-Plugin options screen.

Options including setting a Text Domain, for translations. These needs to match the theme slug.

For this reason, a fresh copy TGP Plugin should always be generated from the Download page, when creating a new theme, child theme, or plugin.

Compatibility with theme-check plugin

The TGM developers provide several distribution options, which are detailed in a table.

I intend to distribute the theme via: Some other way

Warning: More than one text-domain is being used in this theme. This means the theme will not be compatible with WordPress.org language packs. The domains found are wp-theme-boilerplate, tgmpa

I intend to distribute the theme via: WordPress.org

No error is generated.

Alternatives

I also stumbled across the WPCore Plugin Manager. This also uses a configuration file, but the file is stored on an external server, which rings alarm bells for me, as I've seen many well-meaning services come and go over the years.

WPCore also promotes a community aspect, where people can share plugin collections.

Rules about including premium plugins in themes

Specific plugins have specific rules:

ACF

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment