-
Notifications
You must be signed in to change notification settings - Fork 42
Problem with sourcemaps #7
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
Comments
Please can you provide more information? |
I'm not sure the current code does what it's supposed to...: if (sourceMap) {
var sourceMapURL = sourceMap.getSourceMapURL();
css += sourceMap.getCSSAppendage();
}
|
It doesn't. There's a lot of needlessly complicated (and partially incomplete!) manual processing where sourcemap JSON is turned back into objects and process : function ( css, extra ) {
var
options = this.options,
sourceMaps = extra.sourceMap,
inputMap = sourceMaps && sourceMaps.getExternalSourceMap(),
output;
options.processImport = false;
if ( typeof options.keepSpecialComments === "undefined" ) {
options.keepSpecialComments = "*";
}
if ( typeof options.rebase === "undefined" ) {
options.rebase = false;
}
if ( typeof options.advanced === "undefined" ) {
options.advanced = false;
}
if ( inputMap ) {
// Strip existing source map URL, or it may end up in sourcesContent.
css = css.replace( /\/\*\# sourceMappingURL=.*\*\/$/, "" );
}
var output = new CleanCSS( options ).minify( css );
if ( inputMap ) {
output.sourceMap.applySourceMap(
new SourceMapConsumer( inputMap ),
sourceMaps.getOutputFileName() || ""
);
sourceMaps.setExternalSourceMap( output.sourceMap.toString());
output.styles += sourceMaps.getCSSAppendage();
}
return output.styles;
} |
@rjgotten: please submit a PR and ping me. |
Any progress? I can't use this plugin as well as it messes with the source map path somehow ( |
When I use sourcemaps in less, I get Unexpected token error in source-map-consumer.js:20.
The text was updated successfully, but these errors were encountered: