How does Trellis deploy a gulp-based theme like Sage?

I’ve set up a development Trellis & Bedrock site and excellent it is too.

I have a gulp-based hand-rolled theme, kinda similar to Sage. I thought that provisioning Vagrant would trigger a node.js build of the theme’s assets from the source code folder. However, it didn’t and I couldn’t find any evidence of node.js having been installed.

How does Trellis deal with the Sage theme, as I can see that that the image assets directory in the git repo is empty?

I’m right behind the ‘only source control your source’ idea, and have digested the Twelve Factor App approach, so I feel there ought to be some other interesting stuff going on, particularly when the site is deployed to a remote server.

And yes, I admit I haven’t set up the Roots Example Project yet but that is because my time is limited by a 7-week old baby!

many thanks, Jake

Trellis makes no assumptions about your theme workflow. The solution is to do it all locally.

In development with Vagrant you get a synced folder so whatever files gulp generates will just be synced to your dev VM.

For deploying to remote sites, Trellis lets you run local commands and then rsync the files over to the remote server. See https://github.com/roots/roots-example-project.com/blob/fa41aff8e48cdad0e36805118464c2a5df7b2070/ansible/group_vars/production#L3-L14 for an example.

Note: those above commands are outdated and will be replaced soon. However it’s the same concept: generate assets locally then copy them over.

Typing this out it makes me realize for development tools like Node + Gulp should probably be installed on the Vagrant VM. Considering our goal is that every developer on a team has the same dev environment it doesn’t make sense to make people go through the trouble of installing Node locally.

But for production we believe you should keep these tools off of the server.

Thank you for swift & concise reply, has made my life a great deal easier.

it doesn’t make sense to make people go through the trouble of installing Node locally.
But for production we believe you should keep these tools off of the server

This is why I think Docker would ultimately be a good direction to go; you could spin up a Docker Node image (locally?) to generate the assets, which would keep it separate from the remote web server whilst ensuring all members on the team have the same easy-to-install stack.

Thanks for creating & developing Trellis/Bedrock/Sage, it is all much appreciated :smile:

1 Like