-
Notifications
You must be signed in to change notification settings - Fork 26.2k
fix(core): Let Chrome be able to use source-maps in the style tag #14175
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
8ff5c6e
to
b2b94d1
Compare
live example: http://plnkr.co/edit/cUYoQWsYX5mVZhYP5GYa?p=preview If you append the following css comments to the dynamically generated style tag, you will see the correct source-map in chrome dev tool:
|
@@ -526,7 +532,7 @@ function stripComments(input: string): string { | |||
} | |||
|
|||
// all comments except inline source mapping | |||
const _sourceMappingUrlRe = /\/\*\s*#\s*sourceMappingURL=[\s\S]+?\*\//; | |||
const _sourceMappingUrlRe = /\/\*#\s*sourceMappingURL=[\s\S]+?\*\//; |
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.
The standard source mapping comment is /*# sourceMappingURL=...*/
. So we needn't support /* #sourceMappingURL=... */
variant
226e64d
to
2462153
Compare
2462153
to
7fbafb0
Compare
Just finished this change.
Sorry, these days I did not check the mail, I will pay more attention to
github notice.
2017-01-30 18:31 GMT+08:00 Dzmitry Shylovich <notifications@github.com>:
… ***@***.**** commented on this pull request.
------------------------------
In ***@***.***/compiler/test/style_url_resolver_spec.ts
<#14175 (review)>
:
> @@ -47,6 +47,14 @@ export function main() {
expect(styleWithImports.styleUrls).not.toContain('http://ng.io/2.css');
});
+ it('should keep /*# ... */ comments', () => {
+ const css =
+ ***@***.*** ***@***.*** '2.css';*/\n/*# sourceURL=.... */\n/*# sourceMappingURL=... */`;
+ const styleWithImports = extractStyleUrls(urlResolver, 'http://ng.io', css);
+ expect(styleWithImports.style.trim())
+ .toEqual('/*# sourceURL=.... */\n/*# sourceMappingURL=... */');
+ });
add the assertion that styleUrls don't contain http://ng.io/2.css
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#14175 (review)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABYQ59P9BUa5-EHf7GGIqPSlcECr5suuks5rXbwfgaJpZM4LwtZe>
.
|
The component style creates a style tag that contains the source-maps, and Chrome will not be able to use it. We need to add `/*@ sourceURL=... */` comments to make Chrome happy. The `/* #sourceMappingURL` syntax is no longer supported and only supports `/*# sourceMappingURL` and `/*#sourceMappingURL`.
7fbafb0
to
1105401
Compare
@vicb could you please make a review of this PR? |
Oh, It's outdated. I will close it. if the issue still exists, I will resend a new PR based on the new code base. |
Did this solution work for anyone? Live demo doesn't work for me. As I understand it will work after changing shadow.css file? What should I change in the given comment? |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
The component style creates a style tag that contains the source-maps, and Chrome will not be able to use it. We need to add /*@ sourceURL=... */ comments to make Chrome happy.
Please check if the PR fulfills these requirements
What kind of change does this PR introduce? (check one with "x")
What is the current behavior? (You can also link to an open issue here)
The component style will create a style tag that contains the sourcemap information, which chrome will not be able to use
What is the new behavior?
The component style will create a style tag that contains the sourcemap information, which chrome will be able to use it.
Does this PR introduce a breaking change? (check one with "x")
If this PR contains a breaking change, please describe the impact and migration path for existing applications: ...
Other information: