Skip to content

Commit 248120d

Browse files
committed
Added watch on start setting
Thanks @bmwigglestein ritwickdey#42
1 parent a1a57d2 commit 248120d

File tree

3 files changed

+109
-78
lines changed

3 files changed

+109
-78
lines changed

docs/settings.md

Lines changed: 101 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,100 +1,128 @@
11
## Settings
22

3-
* ~~**`liveSassCompile.settings.format`**~~
4-
<hr>
5-
* ~~**`liveSassCompile.settings.savePath`**~~
6-
<hr>
7-
* ~~**`liveSassCompile.settings.extensionName`**~~
3+
* **`liveSassCompile.settings.formats`**
4+
To setup Format (style), Extension Name & Save location for exported css [Multiple Format Supported].
85

9-
<hr>
10-
* ***[NEW]*** **`liveSassCompile.settings.formats`** : To setup Format (style), Extension Name & Save location for exported css [Multiple Format Supported].
6+
* *Format can be _`expanded`_, _`compact`_, _`compressed`_ or _`nested`_. Default is _`expanded`_*
117

12-
* *Format can be _`expanded`_, _`compact`_, _`compressed`_ or _`nested`_. _Default is `expanded`._*
13-
14-
* *Extension Name can be `.css` or `.min.css`. Default is `.css`.*
8+
* *Extension Name can be `.css` or `.min.css`. Default is `.css`*
159
16-
* ***[New]*** Save location is relative from workspace root or your Sass files.
17-
* Default value is `null`. (`null` means, it will generate CSS in the location of scss/sass. By The Way, It is `null`, NOT `"null"`).
18-
19-
* "`/`" denotes relative to root.
20-
21-
* "`~`" denotes relative to every sass file. - Complex Scenario. *([Checkout the example](https://github.com/ritwickdey/vscode-live-sass-compiler/issues/26#issue-274641546))*
22-
23-
* *Example :*
24-
25-
```js
26-
"liveSassCompile.settings.formats":[
27-
// This is Default.
28-
{
29-
"format": "expanded",
30-
"extensionName": ".css",
31-
"savePath": null
32-
},
33-
// You can add more
34-
{
35-
"format": "compressed",
36-
"extensionName": ".min.css",
37-
"savePath": "/dist/css"
38-
},
39-
// More Complex
40-
{
41-
"format": "compressed",
42-
"extensionName": ".min.css",
43-
"savePath": "~/../css/"
44-
}
45-
]
46-
```
47-
<hr>
48-
* **`liveSassCompile.settings.excludeList`:** To Exclude specific folders. All Sass/Scss files inside the folders will be ignored.
49-
* _default value :_
50-
```json
51-
"liveSassCompile.settings.excludeList": [
52-
"**/node_modules/**",
53-
".vscode/**"
54-
]
55-
```
56-
* You can use negative glob pattern.
57-
58-
* _Example : if you want exclude all file except `file1.scss` & `file2.scss` from `path/subpath` directory, you can use the expression -_
10+
* *Save location is relative from workspace root or your Sass files (See examples)*
11+
12+
<details>
13+
<summary>Examples</summary>
14+
<div>
15+
16+
```js
17+
"liveSassCompile.settings.formats":[
18+
// This is Default.
19+
{
20+
"format": "expanded",
21+
"extensionName": ".css",
22+
23+
// null -> denotes the same path as the file it's formatting. Note: null not `null`
24+
"savePath": null
25+
},
26+
// You can add more
27+
{
28+
"format": "compressed",
29+
"extensionName": ".min.css",
30+
31+
// / -> denotes relative to root
32+
"savePath": "/dist/css"
33+
},
34+
// More Complex
35+
{
36+
"format": "compressed",
37+
"extensionName": ".min.css",
38+
// ~ -> denotes relative to every sass file (1)
39+
"savePath": "~/../css/"
40+
}
41+
]
42+
```
43+
(1) Complex Scenario. *([Checkout the example](https://github.com/ritwickdey/vscode-live-sass-compiler/issues/26#issue-274641546))*
5944
60-
```json
45+
</div>
46+
</details>
47+
48+
___
49+
50+
* **`liveSassCompile.settings.excludeList`**
51+
To Exclude specific folders. All Sass/Scss files inside the folders will be ignored.
52+
53+
<details><summary>Examples</summary><p>
54+
55+
**Default**
56+
57+
```json
58+
"liveSassCompile.settings.excludeList": [
59+
"**/node_modules/**",
60+
".vscode/**"
61+
]
62+
```
63+
64+
**Negative glob pattern**
65+
Exclude all file except `file1.scss` & `file2.scss` from `path/subpath` directory, you can use the expression
66+
```json
6167
"liveSassCompile.settings.excludeList": [
6268
"path/subpath/*[!(file1|file2)].scss"
6369
]
64-
```
65-
<hr>
66-
* **`liveSassCompile.settings.includeItems`:** This setting is useful when you deals with only few of sass files. Only mentioned Sass files will be included.
70+
```
71+
72+
</p></details>
73+
74+
___
75+
76+
* **`liveSassCompile.settings.includeItems`**
77+
This setting is useful when you deals with only few of sass files. Only mentioned Sass files will be included.
78+
79+
* *NOTE: No need to include partial sass files.*
80+
* *Default value is `null`*
6781

68-
* *NOTE: No need to include partial sass files.*
69-
* *Default value is `null`*
70-
* Example :
82+
<details><summary>Examples</summary><p>
7183
```json
7284
"liveSassCompile.settings.includeItems": [
7385
"path/subpath/a.scss",
7486
"path/subpath/b.scss",
7587
]
7688
```
77-
<hr>
78-
* **`liveSassCompile.settings.generateMap`:** Set it as `false` if you don't want `.map` file for compiled CSS.
89+
</p></details>
90+
91+
___
92+
93+
* **`liveSassCompile.settings.generateMap`**
94+
Set it as `false` if you don't want `.map` file for compiled CSS.
7995
* _Default is `true`._
80-
81-
<hr>
82-
* **`liveSassCompile.settings.autoprefix` :**
83-
Automatically add vendor prefixes to unsupported CSS properties (e. g. `transform` -> `-ms-transform`).
96+
97+
___
98+
99+
* **`liveSassCompile.settings.autoprefix`**
100+
Automatically add vendor prefixes to unsupported CSS properties (e. g. `transform` -> `-ms-transform`).
84101

85102
* _Specify what browsers to target with an array of strings (uses [Browserslist](https://github.com/ai/browserslist))._
86-
* _Set `null` to turn off. (Default is `null`)_
87103

88-
* Example:
104+
<details>
105+
<summary>Examples</summary>
106+
<p>
107+
108+
**Default**
109+
```json
110+
// null -> denotes off
111+
"liveSassCompile.settings.includeItems": null
112+
```
113+
114+
**Example**
89115
```json
90116
"liveSassCompile.settings.autoprefix": [
91117
"> 1%",
92118
"last 2 versions"
93119
]
94120
```
95-
<hr>
96-
* **`liveSassCompile.settings.showOutputWindow` :** Set this to `false` if you do not want the output window to show.
97-
* *NOTE: You can use the command palette to open the Live Sass output window.*
98-
* *Default value is `true`*
121+
</p></details>
99122

100-
<hr>
123+
___
124+
125+
* **`liveSassCompile.settings.showOutputWindow`**
126+
Set this to `false` if you do not want the output window to show.
127+
* *NOTE: You can use the command palette to open the Live Sass output window.*
128+
* *Default value is `true`*

src/StatubarUi.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ export class StatusBarUi {
1414
return StatusBarUi._statusBarItem;
1515
}
1616

17-
static init() {
17+
static init(watchOnLaunch) {
1818
StatusBarUi.working("Starting...");
1919
setTimeout(function(){
20-
StatusBarUi.notWatching();
20+
watchOnLaunch ? StatusBarUi.watching() : StatusBarUi.notWatching();
2121
},1000);
2222
}
2323

@@ -37,7 +37,7 @@ export class StatusBarUi {
3737

3838
static working(workingMsg:string = "Working on it...") {
3939
StatusBarUi.statusBarItem.text = `$(pulse) ${workingMsg}`;
40-
StatusBarUi.statusBarItem.tooltip = 'In case if it takes long time, Show output window and report.';
40+
StatusBarUi.statusBarItem.tooltip = 'In case it takes a long time, show output window and report.';
4141
StatusBarUi.statusBarItem.command = null;
4242
}
4343

src/appModel.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,9 @@ export class AppModel {
1717
isWatching: boolean;
1818

1919
constructor() {
20-
this.isWatching = false;
21-
StatusBarUi.init();
20+
this.isWatching = Helper.getConfigSettings<boolean>('watchOnLaunch');
21+
22+
StatusBarUi.init(this.isWatching);
2223
}
2324

2425
static get basePath(): string {
@@ -30,6 +31,7 @@ export class AppModel {
3031
* @param WatchingMode WatchingMode = false for without watch mode.
3132
*/
3233
compileAllFiles(WatchingMode = true) {
34+
3335
if (this.isWatching) {
3436
vscode.window.showInformationMessage('already watching...');
3537
return;
@@ -44,6 +46,7 @@ export class AppModel {
4446
}
4547
this.toggleStatusUI();
4648
});
49+
4750
}
4851

4952
openOutputWindow() {

0 commit comments

Comments
 (0)