I’m loving Sage and the Roots push for bringing modern web development practices to WordPress.
I am looking to setup projects using Bower and Composer and splitting functionality I use often into plugins and front end components.
What I am currently wondering is how to best integrate these package managers with Git.
Is it possible to make my own private Bower and Composer packages, pulling them in by their respective package managers and then update those projects through Git while also updating my theme as necessary?
For instance, I start a new theme using Sage as my starter theme. I use Bower to pull in my private Sass library and composer to pull in a couple private plugins. During the course of my workflow, I make changes to the theme, the Sass library and the plugins. How can I make sure these changes get reflected in their desired repositories.
Any suggestions? Much thanks!
What if I want to update the repository that a package gets pulled from within the structure of a Sage theme I am working on? For instance, if I need a new Sass function, and I think it would be useful for future projects as well, I would want to add it to my Sass library that I have pulled into my Sage theme via Bower. Is it possible to update the package where it sits in the theme’s bower_components directory, test it, and then update the respective repository?
Sure, you just need to commit the new code to the actual package’s repository, and then update any projects that are using that package in order to get the new updates.
You can use bower install git/path to install your plugin. It may not be the proper way (please correct if not), but by using the bower.json files you can have gulp build js and css into the dist folders. I’m still not sure the best way to include other things, like a php library.
I’ve figured out how to pull in my private Bitbucket repository through bower and have created the necessary bower.json file for the package.
I’m still stuck on submitting changes back to the repository. I’m fairly new to git and pulling in through the package manager doesn’t pull down the usual git information.
There is a --prefer-source option for Composer that downloads the full repository to the vendor directory. I haven’t found similar for Bower.