Bundle and enqueue css and scripts


If you want to bundle page specific css or scripts and enqueue it in your sage theme sage/app/setup.php you need to edit bud.config.mjs in the root of your sage theme

export default async (app) => {
  app
  /**
  * Application entrypoints
  */
  .entry({
    app: ["@scripts/app", "@styles/app"],
    editor: ["@scripts/editor", "@styles/editor"],
    login: ["@styles/login"],
  })

Here I have added login to the default app and editor.

If you try and add bundle(‘login’)->enqueue() without adding login to your bud config you will get an array key not found error.

, ,

Leave a Reply

Your email address will not be published. Required fields are marked *