Skip to content

Defining Scoped Files

James edited this page Apr 14, 2024 · 1 revision

newtralize allows you to scope CSS, JavaScript, and PHP files to specific pages, menus, articles, and categories.

Scoped files are organized in specific folders, first by filetype and then by scope type.

├── css/
│   ├── articles/
│   ├── categories/
│   ├── menus/
│   └── pages/
├── js/
│   ├── articles/
│   ├── categories/
│   ├── menus/
│   └── pages/
└── heads/
    ├── articles/
    ├── categories/
    ├── menus/
    └── pages/

Creating a Page-Scoped File

To scope a file to a specific menu item, create a file named with either the menu item's alias or ID (this depends on the setting in the Scoped Code Settings) at one of these paths:

  • /css/pages/[filename].css
  • /js/pages/[filename].js
  • /heads/pages/[filename].php

Creating a Menu-Scoped File

To include a file on all pages in a specific menu, create a file named with the menu's alias at one of these paths:

  • /css/menus/[filename].css
  • /js/menus/[filename].js
  • /heads/menus/[filename].php

Creating a Category-Scoped File

To scope a file to all articles in a specific category, create a file named with either the category's alias or ID (this depends on the setting in the Scoped Code Settings) at one of these paths:

  • /css/categories/[filename].css
  • /js/categories/[filename].js
  • /heads/categories/[filename].php

Creating an Article-Scoped File

To scope a file to a specific article, create a file named with either the article's alias or ID (this depends on the setting in the Scoped Code Settings) at one of these paths:

  • /css/articles/[filename].css
  • /js/articles/[filename].js
  • /heads/articles/[filename].php
Clone this wiki locally