Discussion:
GitHub submodule theme development?
Micky Hulse
2013-07-05 02:55:23 UTC
Permalink
Hello,

Just curious if anyone here develops themes using GitHub submodules?

I"ve got a standard WordPress local/XAMPP/GitHub/production workflow
setup and that's working pretty good (I've got WordPress setup as a
submodule). I was starting a new theme and thought it might be cool to
make it a submodule.

Before I start down that path, I just wanted to see if anyone here
does this as a regular part of their theme dev workflow? If yes, do
you have any tips? What's your workflow like?

Thanks!
M
Brad Parbs
2013-07-05 03:02:38 UTC
Permalink
I just switched over my installs to use WordPress in a Git submodule.

Check out http://github.com/bradp/wpeagles to see it in action. I based it off of Mark Jaquith's wp-stack and WordPress skeleton, check those out too!

Brad Parbs
Post by Micky Hulse
Hello,
Just curious if anyone here develops themes using GitHub submodules?
I"ve got a standard WordPress local/XAMPP/GitHub/production workflow
setup and that's working pretty good (I've got WordPress setup as a
submodule). I was starting a new theme and thought it might be cool to
make it a submodule.
Before I start down that path, I just wanted to see if anyone here
does this as a regular part of their theme dev workflow? If yes, do
you have any tips? What's your workflow like?
Thanks!
M
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Brian Hogg
2013-07-05 15:02:35 UTC
Permalink
Mark pointed out that these shouldn't be together, as the config files in the public web root contain passwords. Perhaps another layer so they're out of the web root or just keep them separated?
Post by Brad Parbs
I just switched over my installs to use WordPress in a Git submodule.
Check out http://github.com/bradp/wpeagles to see it in action. I based it off of Mark Jaquith's wp-stack and WordPress skeleton, check those out too!
Brad Parbs
Post by Micky Hulse
Hello,
Just curious if anyone here develops themes using GitHub submodules?
I"ve got a standard WordPress local/XAMPP/GitHub/production workflow
setup and that's working pretty good (I've got WordPress setup as a
submodule). I was starting a new theme and thought it might be cool to
make it a submodule.
Before I start down that path, I just wanted to see if anyone here
does this as a regular part of their theme dev workflow? If yes, do
you have any tips? What's your workflow like?
Thanks!
M
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Simon Weil
2013-07-05 15:22:33 UTC
Permalink
You can use the yeoman wordpress generator for this (I have only played
with it till now but looks promising):

npm install -g yo generator-yo-wordpress
(GitHub<https://github.com/romainberger/yeoman-wordpress>,
npm <https://npmjs.org/package/generator-yo-wordpress>)

or

npm install -g yo generator-wordpress
(npm<https://npmjs.org/package/generator-wordpress>
)
Post by Brian Hogg
Mark pointed out that these shouldn't be together, as the config files in
the public web root contain passwords. Perhaps another layer so they're
out of the web root or just keep them separated?
Post by Brad Parbs
I just switched over my installs to use WordPress in a Git submodule.
Check out http://github.com/bradp/wpeagles to see it in action. I based
it off of Mark Jaquith's wp-stack and WordPress skeleton, check those out
too!
Post by Brad Parbs
Brad Parbs
Post by Micky Hulse
Hello,
Just curious if anyone here develops themes using GitHub submodules?
I"ve got a standard WordPress local/XAMPP/GitHub/production workflow
setup and that's working pretty good (I've got WordPress setup as a
submodule). I was starting a new theme and thought it might be cool to
make it a submodule.
Before I start down that path, I just wanted to see if anyone here
does this as a regular part of their theme dev workflow? If yes, do
you have any tips? What's your workflow like?
Thanks!
M
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Micky Hulse
2013-07-05 17:57:42 UTC
Permalink
Hi Brad, Brian and Simon, thanks so much for the quick replies and
help, I really appreciate it. :)
Post by Brad Parbs
I just switched over my installs to use WordPress in a Git submodule.
Check out http://github.com/bradp/wpeagles to see it in action. I based it off of Mark Jaquith's wp-stack and WordPress skeleton, check those out too!
Oh, nice!

Actually, I was just using (last night) Skeleton
<https://github.com/markjaquith/WordPress-Skeleton>, and
<https://github.com/davidwinter/wordpress-with-git>, to setup
something similar. :)

I've got a pretty good workflow setup for local/prod using a few
simple tools, so I'm stoked on my setup (which is close to yours) so
far.

Anyway, thanks for reply and for showing me your setup! I really
appreciate it. :)
Post by Brad Parbs
Mark pointed out that these shouldn't be together, as the config files in the public web root contain passwords. Perhaps another layer so they're out of the web root or just keep them separated?
Are you saying that the config should not be at the root of the WP
install? Not sure if I follow. In Brad's case, he has wp-config.php at
the top level there ... That seems like a normal spot to put it, esp.
if you have this in your .htaccess:

<files wp-config.php>
order allow,deny
deny from all
</files>

... and permisisons are 400 or 440.

I know that's not 100% security, but it's pretty solid, right?

For my personal setup, I'm just using gitignore to ignore my
local/production config files (I opted to not use wp-stack as I wanted
a more simple setup) but I still keep the config files at my root.

Would you be able to elaborate a tad on "Perhaps another layer so
they're out of the web root or just keep them separated?"

Maybe you're saying to have something like this in wp-config:
include_once(file with sensitive information outside web root);?

Sorry for my barrage of questions. :D
Post by Brad Parbs
You can use the yeoman wordpress generator for this (I have only played
Interesting! Thanks for tip. :)

I used Yeoman a few months back, but I was not sure if it was the tool for me.

I'll have to give it another look.

Thanks folks!
Micky Hulse
2013-07-05 18:07:02 UTC
Permalink
This post might be inappropriate. Click to display it.
Brad Parbs
2013-07-05 18:38:47 UTC
Permalink
I use Git submodules symlinked into my themes folders when developing. On client projects (those w/ themes and plugins) I VC the whole install, with WP in a submodule, keeping it super clean in the repo.

Brad Parbs
Post by Micky Hulse
I should mention, I'm wondering more about developing themes as Git submodules.
Maybe I should be asking if anyone here uses symlinks for themes?
Long story short, I'd like to have a separate version control process
for themes within a version controlled WP install.
My first thought was to use a Git submodule, but I have my concerns
about being able to see the updates as I'm working locally (I've not
used submodules too much, but I know they are a little bit more work
to juggle).
My second thought (which I had as I was going to bed) was to have a
symlink in my WP theme's folder to another repository (locally) which
contained my theme files. I did a quick bit of research last night,
and I could not find anything specifically related to this technique,
other than folks talking about how PHP/WP symlinks have drawbacks.
Anyway, just wanted to clarify my question.
It just feels a tad overkill to version control a whole WP install for
the sake of theme development.
What do you pro hackers do? :)
Thanks!
Micky
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Micky Hulse
2013-07-07 20:07:55 UTC
Permalink
Post by Brad Parbs
I use Git submodules symlinked into my themes folders when developing. On client projects (those w/ themes and plugins) I VC the whole install, with WP in a submodule, keeping it super clean in the repo.
That's cool! I did not see any special setup in
https://github.com/bradp/wpeagles ... Do you happen to have a GitHub
repo with an an example of the theme submodule/symlink setup?

Or, if it's easier and/or not too much trouble, maybe you could
type-out how you have your setups for theme dev?

For example, here's my current setup (like WordPress-Skeleton):

[snip]

+---.htaccess
+---content
| \---mu-plugins
| \---plugins
| \---themes
| \--- ???
| \---index.php
+---index.php
+---wp (WordPress submodule)

[/snip]

In the above, I've put "???" where I'm curious to learn about the
details of your setup.

For example, on your local machine, I assume you just add a simple
symlink to the theme repository? How do you handle the symlinks on a
production machine? Where do you put the theme
folders/repositories/submodules on production?

Sorry if dumb questions, I'm just trying to get a sense of how folks
like to develop themes using VC (whilst VCing everything else). :)

Thanks Brad!!! I really appreciate the help.

Cheers,
Micky
Micky Hulse
2013-07-07 21:07:59 UTC
Permalink
Post by Micky Hulse
In the above, I've put "???" where I'm curious to learn about the
details of your setup.
For example, on your local machine, I assume you just add a simple
symlink to the theme repository? How do you handle the symlinks on a
production machine? Where do you put the theme
folders/repositories/submodules on production?
Also, do you include the theme (or its alias/symlink) in your .gitignore?
Micky Hulse
2013-07-08 02:54:47 UTC
Permalink
So, I've made a little progress (not sure if this is of interest to anyone).

Locally, let's say I've got a WordPress project setup and it's called
"BILLY" (where WordPress core is a Git submodule).

Elsewhere on my computer, I have a theme named "FOO".

In BILLY's /content/themes/ folder, I created a symbolic link to my
local "FOO" theme repository (using XAMPP on a Mac, I've enabled
FollowSymLinks option for my VirtualHost and user/group, set in
httpd.conf, are {my-login's-user}/staff).

Now, as a local test environment, everything's working perfectly.
Nothing too complicated going on here. I dig it. :)

Moving on ...

Because I don't want to VC my themes (or, really, anything in any of
the /content/*/ folders), I've added the below to BILLY's .gitignore:

[snip]

# ... boilerplate .gitignore here ...

# Project-specific #
####################

/wp-config.php
/content/*/*
!/content/*/*.php

[/snip]

The above allows me to ignore things like "themes" and "plugins"
folders but it'll still allow me track changes to boilerplate
index.php files within those boilerplate WP folders.
From there, I've setup a clone of BILLY on my host. Within the remote
BILLY, I've cloned "FOO" into /content/themes/ folder.

Note that the remote's theme is not a submodule; as I'm ignoring
themes in my .gitignore, I don't need to do any tracking of this theme
from BILLY.

Now that everything's setup, I'm able to independently push/pull from
local AND remote BILLY and FOO repositories (I'll mostly be going one
direction, from local to remote, but I like having the option to go
the other way).

Locally, I can make changes to FOO theme and see those changes happen
in real time (i.e. no submodule updating). Once I'm done for the day
(that is, developing my theme, locally) I can push it to GitHub, go to
the remote FOO and `git pull` the latest changes.

Of course, I'm sure this all sounds like crazy talk to all of you pro WP devs.

I know there are a lot more sophisticated tools out there to do
similar work/tasks ... The above is what makes sense to me.

If anyone is listening and/or interested, I'm open to feedback and/or
discussing my setup further. :)

Thanks again to everyone that's helped me out.

Cheers,
M
Micky Hulse
2013-07-08 03:55:24 UTC
Permalink
Lovin' SSH tunneling:

<http://technosailor.com/2013/03/15/tutorial-developing-locally-on-wordpress-with-remote-database-over-ssh/>

I use this technique for Django dev at work ... I'm glad to see that I
can do it with WordPress too. :)

Local dev with a connection to remote DB ... Pretty slick.
Harry Metcalfe
2013-07-08 08:46:58 UTC
Permalink
Since we're having a git workflow discussion, here's ours :)

We make wp-content into a repo. For themes or plugins that are reused in
other projects, we add submodules that are shared. For things specific
to this project, they just live in the main wp-content repo, or
occasionally in their own submodule if that makes it easier to apply
updates.

Once we've got the wp-content directory set up we use Whippet to start a
local development server, and that takes care of the core files for us:

https://github.com/dxw/whippet

We also usually use Less for CSS, so the wp-content repo usually has a a
node manifest and a gruntfile so we can compile and minify css (and do
some other things) in the background while we're developing.

H
Post by Micky Hulse
I should mention, I'm wondering more about developing themes as Git submodules.
Maybe I should be asking if anyone here uses symlinks for themes?
Long story short, I'd like to have a separate version control process
for themes within a version controlled WP install.
My first thought was to use a Git submodule, but I have my concerns
about being able to see the updates as I'm working locally (I've not
used submodules too much, but I know they are a little bit more work
to juggle).
My second thought (which I had as I was going to bed) was to have a
symlink in my WP theme's folder to another repository (locally) which
contained my theme files. I did a quick bit of research last night,
and I could not find anything specifically related to this technique,
other than folks talking about how PHP/WP symlinks have drawbacks.
Anyway, just wanted to clarify my question.
It just feels a tad overkill to version control a whole WP install for
the sake of theme development.
What do you pro hackers do? :)
Thanks!
Micky
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Micky Hulse
2013-07-08 18:37:59 UTC
Permalink
Post by Harry Metcalfe
Since we're having a git workflow discussion, here's ours :)
Awesome! Thanks for sharing! :)
Post by Harry Metcalfe
We make wp-content into a repo.
Ahhh, I was wondering about doing that. It makes sense to version
control the whole wp-content folder.

My solution was to just .gitignore things, but I'll have to play
making wp-content a repo.
Post by Harry Metcalfe
For themes or plugins that are reused in
other projects, we add submodules that are shared.
How to do you test/develop those submodules (or, are they other
people's code that you're just linking to ... i.e you don't modify
directly)?

If you have the time to go into some details, I'm really curious to
hear more about how you develop themes locally and then push/pull
to/from remote/local.
Post by Harry Metcalfe
For things specific to
this project, they just live in the main wp-content repo, or occasionally in
their own submodule if that makes it easier to apply updates.
That makes sense. Do you have any publicly viewable repos that have
this type of setup? Just curious (I think I follow your setup, but I'd
love to have a visual too). :-}
Post by Harry Metcalfe
Once we've got the wp-content directory set up we use Whippet to start a
https://github.com/dxw/whippet
Oh, that's interesting. Thanks for tip/link, I'll check it out. :)
Post by Harry Metcalfe
We also usually use Less for CSS, so the wp-content repo usually has a a
node manifest and a gruntfile so we can compile and minify css (and do some
other things) in the background while we're developing.
+1 for grunt.

Thanks for details! I really appreciate it. :)
Harry Metcalfe
2013-07-08 18:58:49 UTC
Permalink
Post by Micky Hulse
How to do you test/develop those submodules (or, are they other
people's code that you're just linking to ... i.e you don't modify
directly)?
Yup, the latter. As soon as we need to modify something, it goes into a
separate repo just for the project. As a rule, if we're going to apply
upstream updates, we use a submodule. For repos which contain local
modifications it allows us to easily make sure we don't overwrite one of
our changes, and to resolve any conflicts. For ones that don't, we have
a script that downloads the newer plugin version, unzips it, commits it,
and tags it with the version. This makes updating it everywhere really
easy, because we can just update the submodule to the new tag for each
site, commit wp-content, and push to the production branch which
auto-deploys.
Post by Micky Hulse
If you have the time to go into some details, I'm really curious to
hear more about how you develop themes locally and then push/pull
to/from remote/local.
Well, the theme usually just lives in the wp-content repo. Sometimes
we'll have one of the default themes as a submodule, if it's a parent theme.

I'm not sure what more there is to add here -- did you have something
specific in mind? Other than the production branch which we use for
deploys, it's all fairly normal.
Post by Micky Hulse
That makes sense. Do you have any publicly viewable repos that have
this type of setup? Just curious (I think I follow your setup, but I'd
love to have a visual too). :-}
I'm afraid I don't think we do. We have a theme available:

https://github.com/dxw/govuk-blogs/

Which shows how grunt is set up, and how we submodule roots and
bootstrap into themes. That repo is then a submodule in a wp-content
repo which also has a few plugins submoduled. The site is here:

http://blog.gov.uk
Post by Micky Hulse
Oh, that's interesting. Thanks for tip/link, I'll check it out. :)
Let me know how you get on :)
Post by Micky Hulse
+1 for grunt.
Thanks for details! I really appreciate it. :)
Welcome!

Harry
Micky Hulse
2013-07-08 19:33:23 UTC
Permalink
Hi Harry! Thanks again for the help, it's much appreciated. :)

It's great hearing about your workflow too, so thanks for that as well.
Post by Harry Metcalfe
Post by Micky Hulse
How to do you test/develop those submodules (or, are they other
people's code that you're just linking to ... i.e you don't modify
directly)?
Yup, the latter. As soon as we need to modify something, it goes into a
separate repo just for the project. As a rule, if we're going to apply
upstream updates, we use a submodule. For repos which contain local
modifications it allows us to easily make sure we don't overwrite one of our
changes, and to resolve any conflicts. For ones that don't, we have a script
that downloads the newer plugin version, unzips it, commits it, and tags it
with the version. This makes updating it everywhere really easy, because we
can just update the submodule to the new tag for each site, commit
wp-content, and push to the production branch which auto-deploys.
That sounds like an awesome workflow/setup! Thank you for giving
me/the list more details.

My personal WP workflow will probably never get to that high of a
level (honestly, some of it sounds more complex than my brain could
handle). :D
Post by Harry Metcalfe
Post by Micky Hulse
If you have the time to go into some details, I'm really curious to
hear more about how you develop themes locally and then push/pull
to/from remote/local.
Well, the theme usually just lives in the wp-content repo. Sometimes we'll
have one of the default themes as a submodule, if it's a parent theme.
I'm not sure what more there is to add here -- did you have something
specific in mind? Other than the production branch which we use for deploys,
it's all fairly normal.
No, that's great! I think I get it now. Thank you for the additional details!
Post by Harry Metcalfe
Post by Micky Hulse
That makes sense. Do you have any publicly viewable repos that have
this type of setup? Just curious (I think I follow your setup, but I'd
love to have a visual too). :-}
https://github.com/dxw/govuk-blogs/
Awesome, thanks! Checking it out now. :)

Thanks for sharing!
Post by Harry Metcalfe
Which shows how grunt is set up, and how we submodule roots and bootstrap
into themes. That repo is then a submodule in a wp-content repo which also
http://blog.gov.uk
Oooh, nice! Impressive work! I'm looking forward to
installing/dissecting your theme. :)

Thanks again Harry!!!! Much appreciated.

Have an awesome day.

Cheers,
Micky

Loading...