I have an ASP.NET Core project, which also hosts an Aurelia CLI project, using TypeScript / SASS. The IDE is Visual Studio 2015.
When the project is built by Visual Studio or MSBuild, the au build
command is executed in the precompilation target, so when I build or run the ASP.NET Core project from Visual Studio using F5, Aurelia CLI will build and bundle the assets for the Aurelia app into wwwroot
as well.
This workflow ensures that any solution changes are correctly built, and it also ensures that .NET Core is running as the web server, however, it's slow for developers, because any changes to front-end code (HTML, SASS, or TS) that need to be made requires full recompilation / bundling of the Aurelia app as well.
Recent changes to the Aurelia CLI (0.25+) have sped up the front-end build a lot, which is great, but it's still not optimal.
I can't use au run --watch
because that doesn't run the .NET Core server.
I'm looking for guidance on how to optimize the developer workflow for this configuration - ideally, hitting F5 should work as it currently does, but with the addition of activating the watch in Aurelia as well, so that any changes to watched files will trigger an incremental build in Aurelia which updates the browser directly.
We use au run --watch
almost exclusively but we still run the app via F5 in VS as you would expect. We don't care that the run command actually serves the files (if there was a watch flag on the build command we would use au build --watch
instead). We start the watch automatically when the project is first opened, then we can manually stop/restart it as we work throughout the day using tasks we defined in a gulpfile (see below) and the Task Runner Explorer window (so I don't need to have a console open). This way I only need to recompile the server side code when I actually change server side code.
We don't have browsersync set up so this doesn't refresh the browser automatically, but we're fine with that - I don't find that ctrl+R is a big time sink.
We have "au build --env prod" in the prepublish step to make sure the build machine does a production build.
Our gulpfile.js:
var gulp = require('gulp');
var shell = require('gulp-shell');
gulp.task('build-dev', shell.task(['au build --env dev']));
gulp.task('watch', shell.task(['au run --watch']));
gulp.task('test', shell.task(['au test --watch']));
gulp.task('build-prod', shell.task(['au build --env prod']));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With