Comments (10)
I would also love this feature, I did a really quick and dirty implementation on my own just to try something out and it's exactly what I need.
from live-server.
$ live-server --watch=path,another/path
Where --listen
is .
by default, and can be a comma-separated string of paths.
from live-server.
@tapio @harrytruong --listen
is undocumented in the README
from live-server.
+1
from live-server.
There is --ignore=path
which could probably achieve the desired effect, if the less files are in a directory which can be ignored as a whole.
from live-server.
Pardon pseudo code, on my phone. Scanning the code (on my phone at least), looks like index.js at LiveServer.start() has this line
var watchPaths = [root];
Where root is the server root or cwd. I think adding a - - watch-paths OPTION that took a comma separated list and using in in the above line something like:
var watchPaths = options.watchPaths || [root]
Would do the trick. Then you can serve from the root, but only reload when a certain directory changes.
This is preferred over ignoring because in this use case you would need to ignore many files and directories to get the same result. Also, some files and directories can be generated during run time making it more ambiguous what to ignore.
I can do a PR for the full and proper enhancement if you'd like this option added.
from live-server.
Sorry about caps, phone typo!
from live-server.
Should probably think also about using watchr's ignoreCustomPatterns
feature: might be nice to ignore e.g. all files that have .less/.scss extension.
from live-server.
Less files were just an example use case. The real fix here is targeting what to watch. For instance, it's common to have an app or src directory that has a build step that builds to a dist or build folder. There can be files of all types in both. The goal is, you only want to reload when the build / dist directory is updated, not based on file types.
There are similar patterns to this feature in Webpack's loader config. You can 'exclude' patterns from being run through the loader, but you can also 'include' patterns. The include is the recommended approach in the docs because it is explicit. There is a finite and well defined list of things you want to parse opposed to an infinite list of things you want to exclude (everything else).
Babel has a similar option with its register hook. You can compile 'only' certain patterns or 'ignore'. Or what if mocha had you ignore every directory that did not have tests in it?
I guess what I'm getting at is that when you know exactly what you want to watch, it is easier and makes more sense to explicitly define it that try to ignore every other possible thing.
That's my whole hearted attempt at a persuading you :) Whether the update makes it or not, still love the module and will probably keep using it.
from live-server.
Thanks, super appreciated @tapio!
from live-server.
Related Issues (20)
- Handling Content-Security-Policy (CSP)
- "live-server": 1.2.1 references to "chokidar": "^2.0.4" which contains "glob-parent": "^3.1.0"
- Is this project alive? HOT 7
- Can live-server show file details like Apache?
- Bug: `/usr/bin/env: βnode\rβ: No such file or directory` HOT 12
- not working
- Live-server doesn't view changes automatically
- up to date alternative HOT 3
- It doesn't reload on changes HOT 2
- Prevent script injection in an iframe HOT 1
- liveReload no work in WSL2
- Does not load at all
- Live-server links to local files do not work HOT 6
- https not working properly
- How can I get live-server to work with URLs that are prepended with a base URL during production builds?
- Consider moving to esm and then build for cjs HOT 2
- Install anguar app but when refresh its coming 404 error, route not working
- 'live-server' is not recognized as the name
- Should entry file flag take precedence over the index file?
- On mac, installed live-server but the main script has CRLF line terminators HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from live-server.