Asset URL Imports

Any files inside the app folder can be imported into your modules. Remix will:

  1. Copy the file to your browser build directory
  2. Fingerprint the file for long-term caching
  3. Return the public URL to your module to be used while rendering

It’s most common for stylesheets, but can used for anything.

  1. import type { LinksFunction } from "@remix-run/node"; // or cloudflare/deno
  2. import banner from "./images/banner.jpg";
  3. import styles from "./styles/app.css";
  4. export const links: LinksFunction = () => {
  5. return [{ rel: "stylesheet", href: styles }];
  6. };
  7. export default function Page() {
  8. return (
  9. <div>
  10. <h1>Some Page</h1>
  11. <img src={banner} />
  12. </div>
  13. );
  14. }