So I found that you are able to add any script to the head tag of your Magento 2 site via the Magento 2 interface content->configuration->html head-> scripts and sheets.

I've added a:

 <script type="text/javascript" src="site/js/scripts.js"></script>

Is this Ok ? Any downsides etc ?


One major downside i see it will be applied to all pages i.e. script will be included on all pages even if you require or not . You can use your tag in your layout and add Js only to pages that you require

Also it will be skipped from any bundling or merging of JS that magento does for performance optimisation.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.