Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

2.0 KB
Raw Blame
/* Source for the stylesheet the messaging preference pages load.
 *
 * Those pages are Django templates, not part of the app bundle, so they need a stylesheet of
 * their own. Tailwind's play CDN is not an option: it is a third-party script on a page reached
 * from an email link that carries a signed subscriber token, and it compiles in the browser,
 * which Tailwind's own documentation says is not for production.
 *
 * This is deliberately the stock Tailwind theme rather than the app's. The templates use default
 * palette names (bg-gray-50, bg-blue-500, text-amber-600), which `common/tailwind` replaces with
 * PostHog CSS variables, so building them against the app theme would drop those utilities.
 *
 * Regenerate with `pnpm --filter=@posthog/frontend build:message-preferences` after editing
 * either template. The output is committed so the dev server and collectstatic both have it,
 * the same way frontend/public/posthog-ai-onboarding holds committed build output.
 *
 * The script runs this file through the same PostCSS plugins as the app's own CSS build, so the
 * pages get the app's production browser targets. Tailwind 4 writes colors as oklch(), which older
 * browsers in those targets cannot read, and postcss-preset-env lowers them to rgb() for them.
 */

/* `source(none)` turns off automatic source detection. Without it Tailwind also scans up from
 * this file into frontend/src, which made the output four times larger and, worse, let it
 * satisfy classes these templates never reference. */
@import 'tailwindcss' source(none);
@source '../../../products/messaging/backend/templates/message_preferences';

/* The toggle knobs in preferences.html set `border-4` with no border color. Tailwind 4 draws an
 * uncolored border in currentColor, which is black on these pages, so this sets gray-200 as the
 * default border color that the templates are designed around. */
@layer base {
    *,
    ::after,
    ::before,
    ::backdrop,
    ::file-selector-button {
        border-color: var(--color-gray-200, currentcolor);
    }
}