Skip to content
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

refactor: modifying source map support to also support relative urls in stylesheets #165

Closed
wants to merge 12 commits into from

Conversation

john-bai
Copy link

@john-bai john-bai commented Jan 16, 2017

Fixing broken relative and protocol-relative url() use in stylesheets when source maps are enabled. Chrome Canary 57.0.2981.0 and Firefox 50.1.0 support loading source maps when sourceMapURL directive is dynamically added to a new or existing style element in the DOM. This means that style-loader can simply add the styles and sourceMapURL directive as text inside a style element and the source map will be loaded by the browser. Given the simpler insertion method, the relative and protocol-relative urls in stylesheets will not break.

Plenty of discussion on this bug in #124. This PR would be great to merge in once browser support is at an acceptable level. Currently Chrome Canary 57.0.2981.0 and Firefox 50.1.0 work with this source map support.

README updated to remove the warning about source maps and relative urls in styles breaking.

TheLarkInn and others added 3 commits January 11, 2017 09:37
Change Readme to use new Rule.use configuration
… when source maps are enabled. Chrome Canary 57.0.2981.0 and Firefox 50.1.0 support loading source maps when sourceMapURL directive is dynically added to a new or existing style element in the DOM. This means that style-loader can simply add the styles and sourceMapURL directive as text inside a style element and the source map will be loaded by the browser. Given the simpler insertion method, the relative and protocol-relative urls in stylesheets will not break.
@jsf-clabot
Copy link

jsf-clabot commented Jan 16, 2017

CLA assistant check
Thank you for your submission, we really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
6 out of 7 committers have signed the CLA.

✅ TheLarkInn
✅ d3viant0ne
✅ john-bai
✅ simon04
✅ bebraw
✅ ryani33
❌ joeshub

@john-bai john-bai changed the title Modifying source map support to not break relative url use in stylesheets Modifying source map support to also support relative url use in stylesheets Jan 16, 2017
Copy link
Contributor

@bebraw bebraw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Plenty of discussion on this bug in #124. This PR would be great to merge in once browser support is at an acceptable level. Currently Chrome Canary 57.0.2981.0 and Firefox 50.1.0 work with this source map support.

I think this has to wait till the browsers have caught up.

Great work, though, as it cuts a lot of code. Tests would be good to add.

@joshwiens
Copy link
Member

@john-bai This needs to be rebased to pick up changes in master

@ekulabuhov
Copy link
Member

This also supersedes/fixes #124. Chrome v57 should enter stable somewhere at the end of this month. Firefox is at v51 already.

@joshwiens
Copy link
Member

Personally, I think it would be more valuable to land #124 as a patch and include #165 in the next major given we are waiting on browser support as long as @john-bai is fine with updating this PR to accommodate the changes that would land in #124

@joshwiens
Copy link
Member

joshwiens commented Mar 10, 2017

@john-bai - Chrome 57 global rollout started a few hours ago, can you get this rebased so we can get this PR on deck.

screen shot 2017-03-10 at 2 14 06 pm

@bebraw
Copy link
Contributor

bebraw commented Apr 4, 2017

@john-bai Can you rebase? Thanks.

@michael-ciniawsky michael-ciniawsky changed the title Modifying source map support to also support relative url use in stylesheets refactor: modifying source map support to also support relative urls in stylesheets Apr 18, 2017
@mgol
Copy link
Contributor

mgol commented Apr 19, 2017

This PR would also resolve #121; I verified that this issue is caused by using blobs and it doesn't exists when bare <style> tags are used instead of <link rel="stylesheet">.

Is anything except a rebase needed to land & release this? Some tests?

@michael-ciniawsky
Copy link
Member

michael-ciniawsky commented Apr 19, 2017

@mgol

  • CLA Sign
  • Rebase
  • Test

The author needs to sign the CLA before we can merge && move on with this PR (even if unfinished) or someone picks the changes here and opens a new PR :) Test(s) would be appreciated

This change is definitely needed

@michael-ciniawsky
Copy link
Member

Fixes #121 #194

@mgol
Copy link
Contributor

mgol commented Apr 20, 2017

@michael-ciniawsky As I understand, the author did sign the CLA. The checker failed because of a merge commit in this PR that pulled in changes by other people not all of whom signed the new CLA.

@michael-ciniawsky
Copy link
Member

@mgol That could get annoying maybe the PR even needs to be reopened enterily. As I understand the CLA Bot checks the commit authors and there is nearly no way to fix it :). If you have time and interest feel free to open a new PR with these changes

@mgol
Copy link
Contributor

mgol commented Apr 21, 2017

@michael-ciniawsky I rebased it, see #219. I can add proper tests, just please comment on what else might be needed to land it.

@michael-ciniawsky
Copy link
Member

Superseded by #219

@michael-ciniawsky michael-ciniawsky modified the milestone: 1.0.0 May 8, 2017
Kronuz added a commit to Kronuz/UniversalWebpackTarget that referenced this pull request May 23, 2018
Fixes #165
webpack-contrib/style-loader#165

Using #219
refactor: use annotation comments for source maps (`options.sourceMap`)
webpack-contrib/style-loader#219
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants