Guide 03 · Developer docs

The theme repo and the asset pipeline

Everything a developer changes on a Core dna site lives in its theme repository. This guide covers the repository and its build, printing records in templates, stylesheets and client-side code, and the parts of a site around the main content.

L1–L2
Unit 01 · Anatomy of a theme repo

What must never be committed

Provider keys, mail-service credentials, deploy credentials, environment files and local IDE settings do not belong in a theme repository. The categories with the shapes they take in real repositories, where each belongs instead, and what to do when one is already in the history: rotate it.

Who this is for. Everyone who commits to a theme repository, and whoever reviews their changes. Afterwards you can recognise a secret before it is committed, keep the repository's ignore list honest, and handle one that has already been committed in the right order.

Why a private repository is not private enough

A repository is copied to every developer's laptop, every contractor's, every build server and every backup, and a commit stays in the history of all of them for good. Deleting the file in a later commit removes it from the latest version only. A secret committed once has to be treated as known.

The categories

WhatShapes it takesWhere it belongs
Provider API keysPayment gateway secrets, CRM and marketing tokens, server-side map or geocoding keys, written into a template, a script or a config fileThe module's settings in the admin
Mail-service credentialsA mail provider's API key in a tracked .settings.jsonThe mail settings in the admin
Deploy credentialsAn SFTP host, user name, private-key path and passphrase in a tracked upload script such as .build/ssh-config.js, even one whose fields are empty todayThe developer's own machine, in a file the repository ignores
Environment files.env, .env.*, .environment.jsonThe server or the developer's machine; never the repository
Local IDE settings.idea/, .vscode/, including deployment and SFTP settings saved thereThe developer's machine
Platform credentialsA Core dna API key, an OAuth token or a webhook token copied into a script or a noteA secret store or the environment of the program that uses it

A site's .settings.json deserves its own mention. It overrides the admin's settings, and the platform's code describes it as a file kept out of the repository and controlled by system administrators. Several repositories track it all the same, because it is also where a site's template engine can be set, and two production repositories track a mail provider's credentials in it. If yours is tracked, keep only non-secret values in it.

Site data is not a place for secrets either: whatever a template prints from it is public, and the API returns it to any authenticated reader.

Keys that a browser must see, such as a maps key used from JavaScript, end up in the page source anyway. Restrict them to your domains at the provider instead of trying to hide them.

An ignore list to start from

Most production repositories ignore node_modules/ and .idea; few ignore .env. Add the missing lines now, before anyone needs them:

Shell .gitignore
node_modules/
.env
.env.*
.environment.json
.idea/
.vscode/
.build/ssh-config.js
*.pem

An ignore rule does not untrack a file that is already committed: git rm --cached <file> does, in the same commit as the rule. Before committing, read git diff --cached rather than trusting git add ..

When a secret is already in the history

  1. Rotate it first. Issue a new key or password at the provider, put the new one where it belongs (the admin's settings, the server), and revoke the old one. This is the only step that makes the leak harmless.
  2. Check whether it was used. Most providers show recent use of a key; look at the period since the commit.
  3. Then remove it from the repository in a normal commit, and add the ignore rule. Rewriting history to erase it is optional tidying: every existing clone already holds the old value, which is why rotation comes first and is not optional.
  4. Tell whoever owns the site, with the date of the commit and what the secret could reach.
Deleting the file is not a fix

A key removed from the latest commit is still in every clone's history and can still be used. Until it has been revoked at the provider, treat it as public.

Go deeper

Was this page helpful?

Your answer goes to the docs team.