Last active
October 13, 2020 10:22
-
-
Save ChaseH88/6cc2ce4a4369dd8bc947b29b1f696cd9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /** | |
| * Extract specific files from HTMLWebpackPlugin | |
| * https://webpack.js.org/plugins/html-webpack-plugin/ | |
| */ | |
| <% function extractHash(pattern){ %> | |
| <% return Object.values(htmlWebpackPlugin.files.js).filter(function(val) { %> | |
| <% return val.match(pattern) %> | |
| <% }); %> | |
| <% } %> | |
| /** | |
| * @example | |
| */ | |
| <script src="<%=extractHash(/\/js\/appLoading-\w+\.js/)%>"></script> | |
| /** | |
| * Expected Output: | |
| * /js/appLoading38978911087464.js | |
| */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment