Can you setup local development on HubSpot CMS?

Hey there,

I’m gonna work on getting my code nice enough to put on a repo for you guys and start using a .env file so I can obscure my HAPI key. But Luke encouraged me to pop on here and post about my local dev environment. From my post on the developers slack:

“i’ve had bad results trying FTP stuff from my gulp taskrunner into the CMS - but recently i’ve cooked up a gulp recipe that allows me to compile my sass and shoot it to CMS API instead. makes my life so much easier.”

Right now I’m only using my local environment to do SASS. I’m working on a VSCode Language Extension for HTML + HubL as I have time for it, but I still use the web editor for my HTML and HubL since I can’t stand not having syntax highlighting.

For this Gulp recipe, you need these npm or yarn packages:

  • ‘gulp-sass’
  • ‘request’
  • ‘fs’
  • ‘prompts’

I load in the path and hubspot ID for each asset I’m working with into some JSON. I have Gulp compile down anything it sees changed and then I use the ‘prompt’ package to allow me at any point while I’m running Gulp to choose any file I’m working with and initiate an API call to replace the source code of that resource with what I have in my local environment. I only really use this when I am creating something that isn’t in production yet.

As I improve my recipe, I’ll add it to this thread in Git so you may be able to set it up yourself.