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

Fix sourceMappingURL in compressed/minified files #142

Closed
wants to merge 1 commit into from

Conversation

rbague
Copy link

@rbague rbague commented Jun 11, 2023

As of right now, the SourceMappingUrls compiler does not work with sass compressed CSS files, as the regex ...

SOURCE_MAPPING_PATTERN = %r{^(//|/\*)# sourceMappingURL=(.+\.map)}

... used to detect sourceMappingURLS expects the comment to be in a new line (which is not the case in the compressed mode, as it outputs everything in a single line).

Following what is stated in the Source Map Proposal, that the annotation must be at the end of the source, I've updated the regex so instead of looking for the comment at the start of a line, it looks for it at the end of the source, and included tests for compressed JS and CSS files.

The new regex should cover all the possible scenarios of how source map annotations are being appended to the generated CSS/JS file:

Let me know if there is anything I need to update to get this merged.

@aaronjensen
Copy link
Contributor

Is this a duplicate of #133?

@rbague
Copy link
Author

rbague commented Nov 9, 2023

Closing this now that #133 is merged and solves the same problem

@rbague rbague closed this Nov 9, 2023
@rbague rbague deleted the fix-compressed-css-sourcemaps branch November 9, 2023 10:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants