-
-
Notifications
You must be signed in to change notification settings - Fork 608
feat: add IE filter support (AlphaImageLoader
)
#638
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #638 +/- ##
==========================================
- Coverage 98.92% 96.58% -2.34%
==========================================
Files 10 10
Lines 371 381 +10
Branches 87 90 +3
==========================================
+ Hits 367 368 +1
- Misses 4 13 +9
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #638 +/- ##
=========================================
- Coverage 98.92% 98.42% -0.5%
=========================================
Files 10 10
Lines 371 381 +10
Branches 87 90 +3
=========================================
+ Hits 367 375 +8
- Misses 4 6 +2
Continue to review full report at Codecov.
|
44d2b63
to
11d81df
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you!
@michael-ciniawsky friendly ping |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have mixed feelings about adding this tbh
@SmileSmith Which version of IE do you need to support atm (is this needed for) ?
@@ -97,6 +97,20 @@ var parserPlugin = postcss.plugin("css-loader-parser", function(options) { | |||
item.nodes.forEach(processNode); | |||
break; | |||
case "item": | |||
if (item.name.indexOf('progid:DXImageTransform.Microsoft.AlphaImageLoader') >= 0){ | |||
delete item.innerSpacingBefore; | |||
delete item.innerSpacingAfter; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\n
if (item.name.indexOf('progid:DXImageTransform.Microsoft.AlphaImageLoader') >= 0){ | ||
delete item.innerSpacingBefore; | ||
delete item.innerSpacingAfter; | ||
var matchSrc = item.name.match(/src=['"]([^'"]+)['"]/); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
matchSrc
=> match
&& \n
delete item.innerSpacingBefore; | ||
delete item.innerSpacingAfter; | ||
var matchSrc = item.name.match(/src=['"]([^'"]+)['"]/); | ||
if (!matchSrc) break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\n
delete item.innerSpacingAfter; | ||
var matchSrc = item.name.match(/src=['"]([^'"]+)['"]/); | ||
if (!matchSrc) break; | ||
var srcUrl = matchSrc[1]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
srcUrl
=> url
&& \n
var srcUrl = matchSrc[1]; | ||
if (options.url && !/^#/.test(srcUrl) && (isAlias(srcUrl) || loaderUtils.isUrlRequest(srcUrl, options.root))) { | ||
item.name = item.name.replace(srcUrl, "___CSS_LOADER_URL___" + urlItems.length + "___"); | ||
urlItems.push({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
urlItems.push({ url: url })
urlItems.push({ | ||
url: srcUrl | ||
}); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
\n
@@ -97,6 +97,20 @@ var parserPlugin = postcss.plugin("css-loader-parser", function(options) { | |||
item.nodes.forEach(processNode); | |||
break; | |||
case "item": | |||
if (item.name.indexOf('progid:DXImageTransform.Microsoft.AlphaImageLoader') >= 0){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment (in brief) here, describing what the following code/case is doing
@michael-ciniawsky thanks, AlphaImageLoader support Sizing background in IE-8 and below and these code will process it's 'src:...' like bacdground: url(...) in IE9 and above, we can use background: url();backgroud-size: .. ; to achieve |
AlphaImageLoader
)
Sry but I have to declined this since |
What kind of change does this PR introduce?
support ie filter.
since IE not supprt background-size. we usually use filter to polyfill background image;
background: url('../images/home@1x.png') no-repeat center; background-size: 100% 100%; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='../images/home@1x.png', sizingMethod='scale');
If relevant, did you update the README?
Summary
for css-loader to support ie filter
Does this PR introduce a breaking change?
No
Other information