Simpler Scaffolding for Static Websites

We are working on some habitat tutorials and would like a simple static website scaffolding that a learner can then dissect in order to create their own scaffolds.

Ideally, the scaffold would have documentation on a landing page which says how to use it, and would include a folder where the files are as its only configuration element. Then it would have a webserver in the background that served those files.

Then the habitat user would be able to deconstruct that scaffold and understand how to make her own.

Could we work together to get this feature (simpler scaffolding MVP as a static website) on the roadmap and developed?

I’m working towards a similar end and would love to collaborate

1 Like

I think it would be great to have a simple way or tutorial to just deploy static files without having to deploy the server as well. This is the corresponding topic I started Deploying static files

I’ve got a plan for a client project that builds a static site using grunt, the plan pulls in core/node as a build time dep, uses npm install && npx grunt build during do_build to build, and then copies the build/ tree to ${pkg_prefix} during do_install

I’m planning to throw up a generalized complete example at some point

Ohh another fun thing is to have your studio run a web server in the background while it’s open by putting something like this in .studiorc:


# install additional packages
echo "--> Installing additional studio packages for development..."
hab pkg install -b core/caddy core/node

# setup caddy server
caddy-start() {

    echo "--> Launching the Caddy web server in the background..."

    echo "    Running: caddy -port ${caddy_port} -root /src browse"
    setsid caddy -port "${caddy_port}" -agree -quiet -root /src -pidfile /hab/bin/ browse &
    echo "    * Open ${caddy_root} to browse /src"
    echo "      (If using Mac or Windows, ensure HAB_DOCKER_OPTS=\"-p ${caddy_port}:${caddy_port}\" was set when entering the studio to expose this port to your host system)"

caddy-stop() {
    [ -f /hab/bin/ ] && {
        echo "--> Stopping web server..."
        CADDY_PID=$(cat /hab/bin/;
        echo "    Killing caddy process #${CADDY_PID}"
        kill "${CADDY_PID}"


## clean up on exit
_cbl_studio_cleanup() {

trap _cbl_studio_cleanup exit

# final blank line
1 Like

Just wanted to let y’all know I’ve been thinking about this — I’ve got a little POC I’m working on now that I’m modeling on @mhedgpeth’s description; will post back here when I have something together.

That’s great news @cnuciato! I’m looking forward to a better onramp to this behavior. Reach out to me if you need anything.