It would be nice if external scripts and stylesheets could be associated with a shortcode. Those external files would be loaded on each page where the corresponding shortcode exists.
Script Tags: They could actually be added to the shortcode itself, but it may be nicer to get them added to the head tag (though maybe not a big deal). Attribute options (such as async and defer) should be included. Inline scripts could be used, but that breaks the separation of markup and code, and could also violate a Content Security Policy.
Link Tags: External stylesheets are only supposed to be included in the head tag, so it’s actually not possible to include a corresponding external file stylesheet inline with the shortcode. Style tags or attributes could be used, but that breaks the separation of markup and style, and could also violate a Content Security Policy.
- The topic ‘Associate External Scripts and Stylesheets’ is closed to new replies.