From ee69a521f0d7da528f495936e49e945991cf4d1c Mon Sep 17 00:00:00 2001 From: Brandon Baker Date: Wed, 14 Feb 2018 00:54:21 -0600 Subject: [PATCH 1/2] added setting that allows live-sass-compiler to start watching sass files on launch --- README.md | 6 ++++++ package.json | 5 +++++ src/StatubarUi.ts | 7 ++++--- src/appModel.ts | 9 ++++++++- 4 files changed, 23 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 355f591..4311c3b 100644 --- a/README.md +++ b/README.md @@ -126,6 +126,12 @@ Open VSCode Editor and Press `ctrl+P`, type `ext install live-sass`. ```
+* **`liveSassCompile.settings.watchOnLaunch` :** Set this to `true` if you want Live Sass Compiler to automatically start watching your .sass or .scss file when you open an applicable workspace. + * *Default value is `true`* + +
+ + ## Extension Dependency This extension has dependency on _[Live Server](https://marketplace.visualstudio.com/items?itemName=ritwickdey.LiveServer)_ extension for live browser reload. diff --git a/package.json b/package.json index 09c4c40..5f66c13 100644 --- a/package.json +++ b/package.json @@ -136,6 +136,11 @@ ], "default": null, "description": "Automatically add vendor prefixes to unsupported CSS properties (e. g. transform -> -ms-transform). Specify what browsers to target with an array of strings (uses [Browserslist](https://github.com/ai/browserslist)). Pass `null` to turn off. \nDefault is `null`" + }, + "liveSassCompile.settings.watchOnLaunch": { + "type": "boolean", + "default": false, + "description": "Set this to `true` if you want Live Sass Compiler to automatically start watching your .sass or .scss file when you open an applicable workspace\nDefault is `false`" } } } diff --git a/src/StatubarUi.ts b/src/StatubarUi.ts index 0bf6a97..9a1e298 100644 --- a/src/StatubarUi.ts +++ b/src/StatubarUi.ts @@ -14,11 +14,12 @@ export class StatusBarUi { return StatusBarUi._statusBarItem; } - static init() { + static init(watchOnLaunch) { StatusBarUi.working("Starting..."); + setTimeout(function(){ - StatusBarUi.notWatching(); - },1000); + watchOnLaunch ? StatusBarUi.watching() : StatusBarUi.notWatching(); + }, 1000); } static watching() { diff --git a/src/appModel.ts b/src/appModel.ts index 7736c50..4566581 100644 --- a/src/appModel.ts +++ b/src/appModel.ts @@ -18,7 +18,14 @@ export class AppModel { constructor() { this.isWatching = false; - StatusBarUi.init(); + let watchOnLaunch = Helper.getConfigSettings('watchOnLaunch'); + + StatusBarUi.init(watchOnLaunch); + + if (watchOnLaunch) { + console.log("\"live-sass-compiler\" is set to watch sass files on launch"); + this.toggleStatusUI(); + } } static get basePath(): string { From d888e3cab09bac7f71d4767b258e75ef6506fd51 Mon Sep 17 00:00:00 2001 From: bmwigglestein Date: Sun, 18 Feb 2018 13:29:52 -0600 Subject: [PATCH 2/2] changed default value of setting to correct value --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 4311c3b..06fe117 100644 --- a/README.md +++ b/README.md @@ -127,7 +127,7 @@ Open VSCode Editor and Press `ctrl+P`, type `ext install live-sass`.
* **`liveSassCompile.settings.watchOnLaunch` :** Set this to `true` if you want Live Sass Compiler to automatically start watching your .sass or .scss file when you open an applicable workspace. - * *Default value is `true`* + * *Default value is `false`*