Skip to content

Commit

Permalink
option for full reload instead of css inject. #41
Browse files Browse the repository at this point in the history
  • Loading branch information
ritwickdey committed Jan 24, 2018
1 parent 43c18dd commit ab14885
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lib/live-server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,7 @@ LiveServer.start = function (options, callback) {
// var addtionalHTMLtags = options.addtionalHTMLtags || []; //dropped the feature
var disableGlobbing = options.disableGlobbing || false;
var onTagMissedCallback = options.onTagMissedCallback || null;
var fullReload = options.fullReload || false;

var staticServerHandler = staticServer(root, onTagMissedCallback);

Expand Down Expand Up @@ -409,7 +410,7 @@ LiveServer.start = function (options, callback) {
}
clients.forEach(function (ws) {
if (ws)
ws.send(cssChange ? 'refreshcss' : 'reload');
ws.send((cssChange && !fullReload) ? 'refreshcss' : 'reload');
});
}

Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,11 @@
"default": 100,
"description": "Delay before reloading. Value in milliseconds. Default is 100"
},
"liveServer.settings.fullReload": {
"type": "boolean",
"default": false,
"description": "By Default Live Server inject CSS changes without full reloading of browser. You can change this behviour by making this setting as `true`"
},
"liveServer.settings.https": {
"type": "object",
"default": {
Expand Down
4 changes: 4 additions & 0 deletions src/Config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,4 +88,8 @@ export class Config {
public static get getWait(): number {
return Config.getSettings<number>('wait');
}

public static get getfullReload(): boolean {
return Config.getSettings<boolean>('fullReload');
}
}
1 change: 1 addition & 0 deletions src/Helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ export class Helper {
proxy: proxy,
cors: true,
wait: Config.getWait || 100,
fullReload: Config.getfullReload,
useBrowserExtension: Config.getUseWebExt,
onTagMissedCallback: onTagMissedCallback
};
Expand Down

0 comments on commit ab14885

Please sign in to comment.