Answer the question
In order to leave comments, you need to log in
How to inject collected scripts and styles into the layout page of an MVC application using gulp?
There are many articles on the Internet on the topic of building a front-end using Gulp, but nowhere is it described how all this will be injected into the layout page, thanks in advance!
I am also interested in the possibility, depending on the environment parameters (production, debug), to change how the files will be added to the layout (for production - glued and minified, for debug - as is)
ASP.NET MVC 5
Answer the question
In order to leave comments, you need to log in
I can help with the second question. Because gulp config file executes node.js we can use its functionality. We usually write something like this:
var isDev = !process.env.NODE_ENV || process.env.NODE_ENV === 'development';
//переменная true если перменная окружения не установлена или равна development
var _if = require('gulp-if');
gulp.task('html', function () {
return gulp.src(path.src.html)
.pipe(gulp.dest(path.dist.html))
.pipe(_if(isDebug,_debug({title:'html'})))
// будем дебажить только если запустили как дебаг
.pipe(reload({stream: true}));
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question