File tree Expand file tree Collapse file tree 3 files changed +6225
-13047
lines changed Expand file tree Collapse file tree 3 files changed +6225
-13047
lines changed Original file line number Diff line number Diff line change 11const HtmlWebpackPlugin = require ( 'html-webpack-plugin' ) ;
22const { inlineSource } = require ( 'inline-source' ) ;
3- const { getTagRegExp } = require ( 'inline-source/lib/utils' ) ;
43const htmlparser = require ( 'htmlparser2' ) ;
54const { Compilation } = require ( 'webpack' ) ;
65
6+ /**
7+ * Retrieve tag regexp for 'attribute'
8+ *
9+ * @param { string } attribute
10+ * @returns { RegExp }
11+ */
12+ function getTagRegExp ( attribute ) {
13+ if ( attribute ) {
14+ // <([a-zA-Z]+)\b[^>]*?\s(?:inline [^>]*?|inline|inline=([\'\"]).*?\2[^>]*?)>(?:<\/\1\s?>)?
15+ return new RegExp (
16+ '<([a-zA-Z]+)\\b[^>]*?\\s(?:' +
17+ attribute +
18+ '\\b[^>]*?|' +
19+ attribute +
20+ '|' +
21+ attribute +
22+ '=([\\\'\\"])(?:true|' +
23+ attribute +
24+ ')\\2[^>]*?)>(?:<\\/\\1\\s?>)?' ,
25+ 'gm'
26+ ) ;
27+ }
28+ return / < ( s c r i p t | l i n k | i m g | o b j e c t ) \s ? [ ^ > ] * ?> (?: < \/ \1\s ? > ) ? / gm;
29+ }
30+
731class InlineSourceWebpackPlugin {
832 constructor ( options = { } ) {
933 this . deleteAssets = [ ] ;
You can’t perform that action at this time.
0 commit comments