gpt4 book ai didi

asp.net-core - 在 VS Code 中构建之前运行 Gulp 任务

转载 作者:行者123 更新时间:2023-12-04 11:43:52 24 4
gpt4 key购买 nike

我有一个新的空 .NET Core 项目。我可以在 VS Code 中构建之前自动运行 Gulp 任务吗?
我可以运行 styles手动执行任务 VS Code package manager -> Tasks: Run Task -> gulp -> gulp: styles ,但是当我构建它时它不会运行。

/// <binding beforebuild="styles"></binding>

var gulp = require('gulp');
var gulpless = require('gulp-less');

gulp.task('styles', function () {
var srcfile = 'styles/Styles.less';
var dest = 'wwwroot';
return gulp
.src(srcfile)
.pipe(gulpless())
.pipe(gulp.dest(dest));
});
我从一些在线教程中得到了这段代码,除了第一行之外,一切正常。
这应该在 VS Code 中工作还是只是 Visual Studio 的奢侈品?

最佳答案

//In this case we’re adding the a task before other task.

gulp.task('watch', ['array', 'of', 'tasks', 'to', 'complete','before', 'watch'], function (){
// ...
})


//And in this case we’re adding for example the browserSync task.

gulp.task('watch', ['browserSync'], function (){
gulp.watch('app/scss/**/*.scss', ['sass']);
// Other watchers
})


//We’ll also want to make sure sass runs before watch so the CSS will already be the latest whenever we run a Gulp command.

gulp.task('watch', ['browserSync', 'sass'], function (){
gulp.watch('app/scss/**/*.scss', ['sass']);
// Other watchers
});

Read this document : Gulp for Beginners

关于asp.net-core - 在 VS Code 中构建之前运行 Gulp 任务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67939643/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com