You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It would be great if rework could write a source map not only to a comment, but optionally to a file. It could look something like this (just pseudo code):
// rework/index.js
Rework.prototype.toString = function(options){
options = options || {};
var result = stringify(this.obj, options);
if (options.sourcemap && !options.sourcemapAsObject) {
if(!options.sourcemapAsFile) {
result = result.code + '\n' + sourcemapToComment(result.map);
} else {
// options.sourcemapAsFile could be a boolean so filePath will be dest file appended with ".map" or it could be a string with custom path
var filePath = get file path from options.sourcemapAsFile;
result = result.code + '\n' + sourcemapToFile(result.map, filePath);
}
}
return result;
};
function sourcemapToFile(map, filePath) {
var convertSourceMap = require('convert-source-map');
fs.writeFilSync(filePath, convertSourceMap.fromObject(map));
return '/*# sourceMappingURL=' + filePath + ' */';
}
The text was updated successfully, but these errors were encountered:
donaldpipowitch
changed the title
Write source map to file not comment
Option to write source map to file
Aug 14, 2014
It would be great if rework could write a source map not only to a comment, but optionally to a file. It could look something like this (just pseudo code):
The text was updated successfully, but these errors were encountered: