diff --git a/README.md b/README.md index 3df2ddb..5b188b0 100644 --- a/README.md +++ b/README.md @@ -131,6 +131,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 `false`* + +
+ + ## 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 b3f8010..3c671fe 100644 --- a/package.json +++ b/package.json @@ -142,6 +142,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`" + }, "liveSassCompile.settings.showOutputWindow": { "type" : "boolean", "default": true, diff --git a/src/StatubarUi.ts b/src/StatubarUi.ts index bd9cac6..401cfa2 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 5d74f15..1a51949 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 {