@ -4,22 +4,10 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
## What this is
A Drupal 10+ custom theme named "Olivesnews" — a fork of Drupal's Olivero theme, customized for the Island Newspapers project (newspapers2.islandarchives.ca). It includes extensive PHP hook implementations, Twig template overrides, and a Babel + PostCSS build pipeline.
A Drupal 10+ custom theme named "Olivesnews" — a fork of Drupal's Olivero theme, customized for the Island Newspapers project (newspapers2.islandarchives.ca). It includes extensive PHP hook implementations and Twig template overrides. CSS and JS are written as vanilla files with no build step.
## Commands
```bash
yarn build # Build both CSS and JS
yarn watch # Watch both CSS and JS (parallel)
yarn build:css # PostCSS only
yarn build:js # Babel transpile only
yarn watch:js-dev # JS watch in development mode (NODE_ENV=development)
yarn lint:css # Stylelint
yarn prettier # Format ES6 and test files
```
BrowserSync for local dev is configured in `bs.js` (proxies a local Drupal instance).
Deployment is via `deploy.sh` — it pushes to Git remote, then SSHes into the server to pull and run `drush cr`.
## Architecture
@ -36,9 +24,9 @@ Deployment is via `deploy.sh` — it pushes to Git remote, then SSHes into the s
### Frontend assets
- **`css/`** — PostCSS source, organized as `base/` (variables, fonts, reset), `components/` (buttons, nav, forms, etc.), `layout/`, and `theme/`.
- **`js/`** — ES6 source files, one per behavior. Key files: `navigation.js`, `second-level-navigation.js`, `nav-resize.js`, `search.js`. Transpiled by Babel to ES5.
- Compiled output goes alongside source (Drupal loads the compiled files referenced in `olivesnews.libraries.yml`).
- **`css/`** — vanilla CSS, organized as `base/` (variables, fonts, reset), `components/` (buttons, nav, forms, etc.), `layout/`, and `theme/`.
- **`js/`** — vanilla JS, one file per behavior. Key files: `navigation.js`, `second-level-navigation.js`, `nav-resize.js`, `search.js`.
- Files are edited and committed directly — no build step required.
### Templates
@ -50,8 +38,4 @@ The theme includes custom config and JS (`js/mirador-mods.js`, `config/mirador_c
## Key conventions
- Node is pinned to 12.22.12 (see `.nvmrc`). Use `nvm use` before running yarn commands.
- Yarn 4.0.2 is used (`.yarnrc.yml`). Run `yarn` not `npm`.
- CSS uses px-to-rem conversion via PostCSS — write in `px`, output is `rem`.
- JS targets ES5 (legacy browser support). Babel config in `package.json` (`@babel/preset-env` with `targets: "defaults"`).
- After any PHP or template change in Drupal, a cache clear (`drush cr`) is required before changes are visible.