Skip to content
This repository was archived by the owner on Dec 10, 2019. It is now read-only.

Commit 331cd26

Browse files
authored
Merge branch 'master' into https-module-http2
2 parents 261dbc8 + c9b6dd8 commit 331cd26

File tree

5 files changed

+20
-3
lines changed

5 files changed

+20
-3
lines changed
File renamed without changes.

.github/ISSUE_TEMPLATE.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
###### Before submitting an issue, please, see https://github.com/tapio/live-server#troubleshooting
2+
3+
## Issue description
4+
5+
## Software details
6+
7+
* OS:
8+
* Browser (if browser related):
9+
* Node.js version:
10+
* `live-server` version:

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ Command line parameters:
5353
* `--watch=PATH` - comma-separated string of paths to exclusively watch for changes (default: watch everything)
5454
* `--ignore=PATH` - comma-separated string of paths to ignore ([anymatch](https://github.com/es128/anymatch)-compatible definition)
5555
* `--ignorePattern=RGXP` - Regular expression of files to ignore (ie `.*\.jade`) (**DEPRECATED** in favor of `--ignore`)
56+
* `--no-css-inject` - reload page on CSS change, rather than injecting changed CSS
5657
* `--middleware=PATH` - path to .js file exporting a middleware function to add; can be a name without path nor extension to reference bundled middlewares in `middleware` folder
5758
* `--entry-file=PATH` - serve this file (server root relative) in place of missing files (useful for single page apps)
5859
* `--mount=ROUTE:PATH` - serve the paths contents under the defined route (multiple definitions possible)
@@ -144,7 +145,7 @@ The server is a simple node app that serves the working directory and its subdir
144145
Contributing
145146
------------
146147

147-
We welcome contributions! See [CONTRIBUTING.md](CONTRIBUTING.md) for details.
148+
We welcome contributions! See [CONTRIBUTING.md](.github/CONTRIBUTING.md) for details.
148149

149150

150151
Version history

index.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ function entryPoint(staticHandler, file) {
120120
* @param watch {array} Paths to exclusively watch for changes
121121
* @param ignore {array} Paths to ignore when watching files for changes
122122
* @param ignorePattern {regexp} Ignore files by RegExp
123+
* @param noCssInject Don't inject CSS changes, just reload as with any other file change
123124
* @param open {(string|string[])} Subpath(s) to open in browser, use false to suppress launch (default: server root)
124125
* @param mount {array} Mount directories onto a route, e.g. [['/components', './node_modules']].
125126
* @param logLevel {number} 0 = errors only, 1 = some, 2 = lots
@@ -148,6 +149,7 @@ LiveServer.start = function(options) {
148149
var https = options.https || null;
149150
var proxy = options.proxy || [];
150151
var middleware = options.middleware || [];
152+
var noCssInject = options.noCssInject;
151153
var httpsModule = options.httpsModule;
152154

153155
if (httpsModule) {
@@ -356,7 +358,7 @@ LiveServer.start = function(options) {
356358
ignoreInitial: true
357359
});
358360
function handleChange(changePath) {
359-
var cssChange = path.extname(changePath) === ".css";
361+
var cssChange = path.extname(changePath) === ".css" && !noCssInject;
360362
if (LiveServer.logLevel >= 1) {
361363
if (cssChange)
362364
console.log("CSS change detected".magenta, changePath);

live-server.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ for (var i = process.argv.length - 1; i >= 2; --i) {
6868
opts.ignorePattern = new RegExp(arg.substring(16));
6969
process.argv.splice(i, 1);
7070
}
71+
else if (arg === "--no-css-inject") {
72+
opts.noCssInject = true;
73+
process.argv.splice(i, 1);
74+
}
7175
else if (arg === "--no-browser") {
7276
opts.open = false;
7377
process.argv.splice(i, 1);
@@ -143,7 +147,7 @@ for (var i = process.argv.length - 1; i >= 2; --i) {
143147
process.argv.splice(i, 1);
144148
}
145149
else if (arg === "--help" || arg === "-h") {
146-
console.log('Usage: live-server [-v|--version] [-h|--help] [-q|--quiet] [--port=PORT] [--host=HOST] [--open=PATH] [--no-browser] [--browser=BROWSER] [--ignore=PATH] [--ignorePattern=RGXP] [--entry-file=PATH] [--spa] [--mount=ROUTE:PATH] [--wait=MILLISECONDS] [--htpasswd=PATH] [--cors] [--https=PATH] [--https-module=MODULE_NAME] [--proxy=PATH] [PATH]');
150+
console.log('Usage: live-server [-v|--version] [-h|--help] [-q|--quiet] [--port=PORT] [--host=HOST] [--open=PATH] [--no-browser] [--browser=BROWSER] [--ignore=PATH] [--ignorePattern=RGXP] [--no-css-inject] [--entry-file=PATH] [--spa] [--mount=ROUTE:PATH] [--wait=MILLISECONDS] [--htpasswd=PATH] [--cors] [--https=PATH] [--https-module=MODULE_NAME] [--proxy=PATH] [PATH]');
147151
process.exit();
148152
}
149153
else if (arg === "--test") {

0 commit comments

Comments
 (0)