At Intracto we use Bamboo to automate building and deployment of our web projects.
All our projects have a comparable directory structure with a Gruntfile in the same location.
There’s a task in bamboo that knows to run
npm install and
grunt build from the root folder to build all the styles and assets.
A project that we’re currently working on has multiple web-heads so it needs to have styles and assets compiled for multiple folders. We could either change the setup and split up the GruntFile or create one file that builds everything at once. The latter is the easiest solution for this particular project, so that’s what we went for.
I’m going to share how we’ve set up the GruntFile, for demo purposes let’s assume this project needs to build for
This is an example of what a basic gruntfile looks like for us. This gruntfile will make sure Sass will be built (with production settings) and css will be shrunk.
Near the bottom of the gruntfile we usually register the build task that triggers the needed modules.
grunt.registerTask('build', ['sass:dist', 'cssshrink']);.
A simple call to
grunt build will trigger both tasks defined, assets’ll be built and everyone is happy.
In this case however, that won’t work.
Instead we’ve registered a task per website that needs to be built and made sure that the
build task will run the other defined tasks
There are other ways to set up this kind of workflow, but this one was easy enough to implement without having to change other parts of our workflow.