porterwp
  • Welcome
  • Quick Start
    • Create your first site
      • Getting started
    • FAQs
  • Config
    • porter.json
      • Theme Support
      • Admin
      • Public
      • Full porter.json example
    • posttypes.json
    • taxonomies.json
    • acf.json
    • blocks.json
  • Filters
    • porter_default_object_args
  • Custom blocks
    • Build script
    • ACF integration
    • Inner blocks
  • INC
    • Block Filters
Powered by GitBook
On this page
  1. Config
  2. porter.json

Public

Public lets you register scripts and styles for the front end.

...
	"public" : {
		"styles" : {
			"admin_css" : {
				"src" : "./assets/dist/css/app.min.css"
			}
		},
		"scripts" : {
			"main" : {
				"src" : "./assets/dist/js/app.js",
				"deps" : [],
				"args" : {
					"in_footer" : true
				}
			},
			"font-awesome" : {
				"src" : "//kit.fontawesome.com/KIT_ID.js",
				"deps" : [],
				"args" : {
				 	"in_footer" : true
				},
				"data" : {
					"crossorigin" : "anonymous"
				}
			}
		}
	}
...
PreviousAdminNextFull porter.json example

Last updated 6 months ago

You may notice the data attribute for scripts. This lets you attach custom attributes to the script tag output, avoiding the need to use the filter.

script_loader_tag