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"
				}
			}
		}
	}
...

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 script_loader_tag filter.

Last updated