Gulp / Sync HTML Inverter with ASP.NET cshtml / razor view

I am working on an ASP.NET MVC 4 project. I would like to use browser synchronization to make markup changes in our razor syntactic representations without reloading the page.

I use Gulp to automate these tasks of synchronizing the browser and the html-injector module ( https://github.com/shakyshane/html-injector ) to enter the html change.

My goal:

  • Run the ASP.NET project.
  • Launch Gulp with the browsersync task.
  • Go to view A.
  • Make a change as a cshtml file.
  • See change as A without reloading the page.

Here is my gulp task:

var gulp = require("gulp");
var browserSync = require("browser-sync").create();
var htmlInjector = require("bs-html-injector");

gulp.task("browserSync", function() {
  browserSync.use(htmlInjector, {
    files: ['**/*.*html']
  });
  browserSync.init({
    proxy: 'localhost:1234',
    files: ['Styles*/**/*.css']
  });
});

I connect to port port 1234 because the ASP.NET project works there.

*.html. .

*.cshtml - .

- ? ASP.NET/Razor, ​​ ?

.

+4

Source: https://habr.com/ru/post/1598118/


All Articles