3/20/2023 0 Comments Wordpress grunt livereloadNormally that’s the name of the project in Visual Studio. (Note the capitalisation.) Then add this to it module.exports = function(grunt) which you should replace with the relative folder path from your solution to your web application folder. In your Solution directory, create a file called Gruntfile.js. Npm install grunt-contrib-watch -save-dev Now install Grunt, the task runner, and Grunt-Contrib-Watch, a package which watches for file changes and triggers useful work. The defaults are fine, but you may need to type your project name in, in lower case, if it complains about your folder name. If you don’t already have a package.json file, open a command window, change directory to your solution folder, and type npm initĪnd hit ‘enter’ a bunch of times. Nodejs.Ĭreate a package.json file in your solution directory. On windows, it’s been the most reliable way for me to get it to run - the original app is an alpha version, there’s not been an update in a long time, and I’ve found it flakey.Ĭome on now. I’ve found the best for me is to use Grunt or Gulp, both of which are designed to work with LiveReload. You need to get LiveReload into your workflow. Operations of thought are like cavalry charges in a battle - they are strictly limited in number, they require fresh horses, and must only be made at decisive moments.” – ANW Civilization advances by extending the number of important operations which we can perform without thinking about them. “It is a profoundly erroneous truism, repeated by all copy-books and by eminent people when they are making speeches, that we should cultivate the habit of thinking of what we are doing. In a very real way, each little bit of friction steals an IQ point or two hoard them for the difficult tasks! As Alfred North Whitehead said: It’s a small - very small - improvement to your workflow if you’re already using LiveReload, but it’s something you do so often that any time you can get rid of a tiny piece of friction, you save yourself a little bit of the mental capacity you use for concentrating on real problems. You use LiveReload to watch for that file, and that will trigger your browser to refresh. The idea is that you add this into your web app (manually stitching it into your CSPROJ file) and when you build your source, it writes a small random file to disk. I decided to fix that with a very small MSBuild target. You really want it to trigger when it finishes a build, once all your binaries are up to date. However, the job isn’t all done, and when you’re making server-side changes - changing controllers and such - LiveReload isn’t as easy to make fire. LiveReload is a really nice solution to that when you’re editing JavaScript and HTML, and in ASP.NET MVC when you’re editing Razor (CSHTML) files. One bit of small friction, but one you pay regularly, is pressing F5 in web applications, reloading the page after you’ve changed the source code. All that ‘ceremony’ that ends up built into your muscle memory to get your projects built and running. I’m all about getting rid of the friction in development.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |