diff --git a/package.json b/package.json index 20e67ac..d305a49 100644 --- a/package.json +++ b/package.json @@ -100,6 +100,13 @@ ], "default": null, "description": "This setting is useful when you deals with only few of sass files. Only mentioned Sass files will be included. \nNOTE: No need to include partial sass files." + }, + "liveSassCompile.settings.generateMap": { + "type": [ + "boolean" + ], + "default": true, + "description": "Choose whether this script automatically comiles map files for the CSS generated from the compiler." } } } diff --git a/src/appModel.ts b/src/appModel.ts index 09b1e1f..654e4bc 100644 --- a/src/appModel.ts +++ b/src/appModel.ts @@ -136,6 +136,7 @@ export class AppModel { * @param options - Object - It includes target CSS style and some more. */ private GenerateCssAndMap(SassPath: string, targetCssUri: string, mapFileUri: string, options) { + let generateMap = helper_1.Helper.getConfigSettings('generateMap'); return new Promise(resolve => { SassHelper.instance.compileOne(SassPath, options) .then((result) => { @@ -146,11 +147,15 @@ export class AppModel { else { let promises: Promise[] = []; let mapFileTag = `/*# sourceMappingURL= ${path.basename(targetCssUri)}.map */` - promises.push(FileHelper.Instance.writeToOneFile(targetCssUri, `${result.text} \n\n ${mapFileTag}`)); - let map = this.GenerateMapObject(result.map, targetCssUri); - promises.push(FileHelper.Instance.writeToOneFile(mapFileUri, - JSON.stringify(map, null, 4))); + if (generateMap === false) { + promises.push(FileHelper_1.FileHelper.Instance.writeToOneFile(targetCssUri, `${result.text}`)); + } + else { + promises.push(FileHelper_1.FileHelper.Instance.writeToOneFile(targetCssUri, `${result.text} \n\n ${mapFileTag}`)); + let map = this.GenerateMapObject(result.map, targetCssUri); + promises.push(FileHelper_1.FileHelper.Instance.writeToOneFile(mapFileUri, JSON.stringify(map, null, 4))); + } Promise.all(promises).then(fileResolvers => { OutputWindow.Show("Generated :", null, false, false);