In case you need to add SRI to script file resources, this great approach should do the trick.
https://joshuatz.com/posts/2020/adding-extra-attributes-to-style-and-script-tags-in-wordpress/
It provides a tool to add any attribute to script and style elements added by wp_enqueue_, and has a good example there, with exactly this thought in mind.
One caveat is it works for scripts in the head and maybe not in the body right now.
*For inline scripts, I am still looking for a good solution myself.
Related Posts:
- How to use wp.hooks.addAction() in React JS/Gutenberg?
- Extend core block in Gutenberg
- Hooking a callback into the code within a Gutenberg block
- How to add extra attributes to the script tag added via wp_localize_script()
- What do the args for Gutenberg subpackage “hooks” function “doAction” mean?
- Use useSelect/useDispatch instead of withSelect/withDispatch
- How to use wp.hooks.addAction() in React JS/Gutenberg?
- useSelect second parameter
- is_front_page() variable not found
- Get terms of a taxonomy using useSelect
- Hook a script as the very last one before the closing body tag
- Issue migrating a checkbox-type meta field to the block editor
- Client side pre-save Javascript hook on all admin pages
- Call javascript function when add_attachment hook fires
- Use add_action to run a script, but only on the post editor page
- Javascript split regex question
- Find object by id in an array of JavaScript objects
- Cannot set property InnerHTML of null [duplicate]
- How can I submit a form using JavaScript?
- How do I empty an array in JavaScript?
- JavaScript TypeError: Cannot read property ‘style’ of null
- JavaScript string newline character?
- How to create a GUID / UUID
- How does “/\s/g” replace spaces with other characters?
- What is the correct way to check for string equality in JavaScript?
- JavaScript TypeError: Cannot read property ‘style’ of null
- Number converted in 1e+30
- Static variables in JavaScript
- ReferenceError : window is not defined at object.
Node.js - Node.js Port 3000 already in use but it actually isn’t?
- Uncaught TypeError: $.post is not a function
- Unable to verify leaf signature
- XML Parsing Error: no root element found Location in Console FF
- TypeError: app.use() requires middleware functions
- Possible to extend types in Typescript?
- JavaScript enumerator?
- How to format numbers as currency strings
- Understanding how data-dismiss attribute works in Bootstrap
- Add table row in jQuery
- Obtain form input fields using jQuery?
- Npm install cannot find module ‘semver’
- How to download a file with Node.js (without using third-party libraries)?
- Getting current date and time in JavaScript
- What is ViewChild in Angular2?
- Permutations in JavaScript?
- How do I remove documents using Node.js Mongoose?
- jQuery make global variable
- Mixed Content Page: requested an insecure stylesheet error
- How to do integer division in javascript (Getting division answer in int not float)?
- javascript unexpected identifier
- How to send email by using javascript or jquery
- Access to Image from origin ‘null’ has been blocked by CORS policy
- Onclick on bootstrap button
- Read XML file using javascript
- Load Image from javascript
- Most efficient method to groupby on an array of objects
- Don’t make functions within a loop [duplicate]
- Difference between ?:, ?! and ?=
- JavaScript post request like a form submit
- How to check ‘undefined’ value in jQuery
- Detecting arrow key presses in JavaScript
- Data column(s) for axis #0 cannot be of type string in google chart dashboard [duplicate]
- JavaScript – Count Number of Visitor for Website
- Jquery Value match Regex
- replace space with dash JavaScript
- Using “×” word in html changes to ×
- How do I store an array in localStorage?
- How to check if the URL contains a given string?
- How to enable CORS in AngularJs
- bootstrap buttons onclick events
- how to use addHTML function in jsPDF
- Rock, Paper, Scissors, Lizard, Spock in JavaScript
- How to fix “TypeError: Right-hand side of ‘instanceof’ is not callable” when I use another module class?
- Change the selected value of a drop-down list with jQuery
- Uncaught SyntaxError: Unexpected token var
- window.location.href doesn’t redirect
- DeprecationWarning: Calling an asynchronous function without callback is deprecated. – how to find where the “function:” is?
- What are the benefits of using wp_enqueue_script?
- Get loading state of wp data selector
- Filter medias from the Media Uploader (wp.media) modal with a post meta
- Adding a text element in between title and blocks container
- Remove type attribute from script added by wp_localize_script
- Block Editor: How to get title and post content within the WordPress admin UI in Javascript?
- Google Map iframe in a tab issue
- Using wp_localize_script inside template page to transfer var from php to js
- Multiple Conditional Controllers
- Adding javascript trigger to user role selection on the user-edit page
- Vue and wordpress.Bad Request ajax request
- How to add if lt IE9 conditional scripts to functions.php
- Looping over wordpress meta to create “ ‘s?
- How to include a JSON file on my page?
- Adding inline JavaScript after wp_enqueue_scripts
- Update media library attachments
- JavaScript Libraries in WordPress
- how to use nimble-API and Display data?
- Create new product with woocommerce REST API with javascript (clientside)?
- Combining results from WP-API using AngularJS
- dropdown does not work [closed]
- Anyway to disable the auto excerpt creation?
- How do I cycle a JS function in WordPress? [closed]