We want to use the same build system across multiple projects. I have a working brunch configuration file that I want to put in a git submodule, so that that submodule can be referenced in multiple projects and changes are easily propagated (less fragile than copy and paste and sets authoritative source of brunch-config.js).
Putting brunch-config.js in a git submodule though causes my folder structure to end up like this:
WebApp // git root
|---Brunch-Build-System // git submodule
| |---brunch-config.js
|---node_modules
|---source // all the source code I want compiled
Brunch operates assuming brunch-config.js would be at the same or higher level than the source being compiled. In this setup, this is not the case. I've tried modifying my brunch-config.js to use a relative path to no avail. Here is my files
block of the Brunch configuration as it currently stands, without any relative path attempt:
files: {
javascripts: {
joinTo: {
'js/lib.js': /^(?!source\/)/
},
entryPoints: {
'source/scripts/app.jsx': {
'js/app.js': /^source\//
},
}
},
stylesheets: {joinTo: 'css/core.css'}
}
How could I modify this to use a relative path given the desired folder structure above? Is this even possible?
A submodule needs to be associates with a root folder within the parent repo: it is the gitlink (a special entry in the main repo index) which records which SHA1 that submodule is checked out.
In your case, it would be best if you can use, in a post-checkout hook, a script ensuring there is a symbolic link between:
brunch-config.js
at its correct place andBrunch-Build-System / brunch-config.js
from the submoduleThe lines to include in the hook would be something along the lines of
#!/bin/bash
if [ ! -e /correct/path/for/brunch-config.js ]; then
ln -s /correct/path/for/brunch-config.js Brunch-Build-System/brunch-config.js
fi
Although the OP being on Windows:
I ended up just programmatically copying the file over and gitignoreing the copied file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With