Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

424
Vistas
.Net Core / Angular CLI - NPM Build Automation (html to cshtml)

I am developing a build process using .Net Core (netcoreapp1.1) and Angular CLI (1.0.1) using npm scripts in Visual Studio 2017.

Is it possible to script npm to take the contents of the Index.html body tag (from the file created by Angular CLI) and place it into the body of a .cshtml file?

Ideally, I would like to use npm scripts exclusively and move away from Gulp, but I can accept a Gulp solution if necessary.

Update for clarification: My objective is to include the necessary scripts from the Index.html file created by Angular CLI into a pre-existing cshtml View that has some code that I need to keep.

If it is necessary to create a new file, is there a way to parse the data from two existing files (html and cshtml) and join them into one? I really just need the scripts from the body of the html added to my View.

over 4 years ago · Santiago Trujillo
2 Respuestas
Responde la pregunta

0

If you're not going to be adding any server code to the generated HTML and you're really just looking to rename file, then it could be as simple as using the CLI itself.

  • Renaming index.html to index.cshtml
  • Updating the index entry in .angular-cli.json to index.cshtml
  • And then build normally using the CLI

I tested this with a new project and seemed to work well with both a dev build (ng b) as well as production (ng b -prod -aot). You may also try actually including some server code, though you may run into some parse errors if the compiler finds invalid markup.

over 4 years ago · Santiago Trujillo Denunciar

0

this is a gulp solution,

var gulp = require('gulp');
var rename = require('gulp-rename');

gulp.task('default', function () {
    copy('<your html path>', 'cshtml file name', '<destination path>');
});

function copy(src, filename, dest) {
    gulp.src(src)
        .pipe(rename(filename))
        .pipe(gulp.dest(dest));
}
over 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda