Skip to content

Use colocated public directories for browser assets#11616

Draft
brookslybrand wants to merge 1 commit into
markdalgleish/assets-allow-packagesfrom
brooks/template-public-directories
Draft

Use colocated public directories for browser assets#11616
brookslybrand wants to merge 1 commit into
markdalgleish/assets-allow-packagesfrom
brooks/template-public-directories

Conversation

@brookslybrand

Copy link
Copy Markdown
Contributor

This stacks on #11480 and explores using colocated public/ directories as the explicit boundary for browser-reachable app source. Features can keep their browser module graph beside its narrowest owner without recreating the app structure in a top-level assets directory or renaming every file.

  • Allow app/**/public/** through the asset server, with app/routes.ts as the shared route-contract exception.
  • Move the browser runtime to app/public/entry.ts and the starter's interactive prompt button to app/ui/public/prompt-button.tsx.
  • Reserve root public/static/ for images, fonts, and other files served unchanged at root URLs.
  • Generate the entry script URL with assetServer.getHref() so it follows asset-server routing and fingerprinting.
  • Update the scaffold guide, Remix app skill, asset/UI examples, release note, and scaffold assertions to teach the same transitive dependency rule.
// Before
allowFiles: ['app/assets/**']
staticFiles('./public', { index: false })

// After
allowFiles: ['app/routes.ts', 'app/**/public/**']
staticFiles('./public/static', { index: false })

Compiled browser source can now be organized by owner:

app/
  public/
    entry.ts
  actions/cart/
    controller.tsx
    public/
      cart-button.tsx
      format-price.ts

@github-actions

Copy link
Copy Markdown
Contributor

Preview Build Available

A preview build has been created for this PR. You can install it using:

pnpm install "remix-run/remix#preview/pr-11616&path:packages/remix"

This preview build will be updated automatically as you push new commits.

@brookslybrand
brookslybrand marked this pull request as draft July 17, 2026 21:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant