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.
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.
index.html to index.cshtmlindex entry in .angular-cli.json to index.cshtmlI 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.
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));
}