Closed Codenator81 closed 8 years ago
the problem is that dnx-watch has to be added by the user (dnu commands install Microsoft.Dnx.Watcher
).
How can we know if the command is available or not?
aspnet/dnx-watch#27
Awesome.. I'll subscribe to that
With the other issue Closed, is there any chance this one will be completed? My guess is you may be seeing a lot of traffic this way due to Scott Hanselman's post of integrating Visual Studio Code and dnx commands.
Why you want dnx-watch if you can just use gulp to kill and restart? It's not like dnx-watch is bringing anything new to the table.
@luisrudge Maybe I'm misunderstanding, but I was under the impression that dnx-watch will watch for file changes and automatically restart the server. (I have also used gulp to this ends, but, following Scott's post that I referenced above allowed me to do away with a bunch of gulp scripting to make that work properly.) Granted, there is the issue of the minification of JS/CSS and the compiling of SCSS that is not part of dnx-watch, but I just run another task that handles that.
If I have an incorrect understanding of the toolchain, I'm happy to learn the best way to use it.
I using nodemon for watching everything. For example
nodemon --ignore htm,html --ext cs,js --exec "dnx web" -V
@Codenator81 it makes no sense to restart the entire dnx app if a .js file changes.. Well.. not in the majority of the cases anyway.
@jasoncavett dnx-watch is good if you're not using a task runner. If you're, your're better off using the task runner to do this.
Simple example:
gulp.task('dnx', dnx('kestrel'));
gulp.task('default', function() {
gulp.watch('./**/*.cs', ['dnx']);
});
Complete example (a little out of date): https://github.com/luisrudge/generator-simple-aspnet/blob/master/app/templates/src/gulpfile.js
@luisrudge Is there any performance trade off doing the gulp-watch instead of this?
I don't think so.. Both are processes that watch some files and, when at least one of the file changes, kill the process and start again.
Cool, wasn't sure if they were doing something efficient under the hood since that have core lib access.
If anything, gulp allows you to pick and choose what files will be watched, so I guess it's a little more flexible
Yup, thats more the 'gulp' way anyways.
Actually, dnx-watch
analyzes project.json
structure and watches any files that are included in the project, as well as all referenced projects and their files. So it may be more convenient to use for larger projects.
Besides, you already use dnx --watch
, so maybe just replace that with plain dnx
to avoid confusion?
@qbikez you don't need to restart when a js, css, cshtml file changes... Gulp, in that way, is better at this because you can pick and choose.
@qbikez I actually ended up building my own plugin for dnx, check it out here: https://github.com/Swimlane/gulp-aspnet5 ( sorry not trying to troll, just help him out )
ASP.NET have now nice dnx-watch comand wich reload server when files changed. It will be great if gulp-dnx have that comand out of box. Thanks