Create A JavaScript File

Create a plain JavaScript file and add any code you need; it will run on every page within the specified directory, executing after reload, page navigation, or a cleanup() call.

/fragments/js/common/test.js

console.log("bing");copy

Configuring JS Common Fragment

Inside the ref object, add a property named common. Its keys must be the absolute pathnames of the directory that need custom code; each value is an array of absolute pathnames pointing to the JavaScript fragments that should run on that page.

/reference.js

export const ref = {
  js:{
    common:{
        "/docs/": ["/fragments/js/common/test.js"]
    }
  }
}copy
JS Specific CSS Constant