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

Map file incomplete source URL #128

Closed
realjjaveweb opened this issue Nov 20, 2019 · 2 comments
Closed

Map file incomplete source URL #128

realjjaveweb opened this issue Nov 20, 2019 · 2 comments
Labels

Comments

@realjjaveweb
Copy link

realjjaveweb commented Nov 20, 2019

Not sure if there is still someone supporting this project, however I've noticed latest wp.org version generates map file with sources defined relatively to main domain, so if wordpress is in subdirectory (like domain.tld/blog/) this will be generated in example.css.map
"sources":["wp-content\/themes\/sometheme\/scss\/example.scss"]
which browser (at least Chrome) will translate to
domain.tld/wp-content/themes/sometheme/scss/example.scss
<= notice the missing /blog/ part

Note: this may or may not be related to issue #105

FIX:

In class/class-wp-scss.php when calling setSourceMapOptions() sourceRoot should reffer to home URL

$scssc->setSourceMapOptions(array(
  'sourceMapWriteTo' => $instance->css_dir . $map, // absolute path to a file to write the map to
  'sourceMapURL' => $map, // url of the map
  'sourceMapBasepath' => rtrim(ABSPATH, '/'), // base path for filename normalization
  
  // FIX: this was previously just '/'
  'sourceRoot' => home_url('/'), // This value is prepended to the individual entries in the 'source' field.
));
@realjjaveweb realjjaveweb changed the title Map file incomplete URL Map file incomplete source URL Nov 20, 2019
@shadoath
Copy link
Collaborator

shadoath commented Feb 15, 2021

@realjjaveweb PR created for this. Can you test this PR on your env?

@shadoath shadoath added the bug label Feb 15, 2021
@shadoath
Copy link
Collaborator

Part of 2.1.4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants