gpt4 book ai didi

gulp - Yeoman generator-angular : 'task wiredep' is not in gulpfile & $. useref.restore 不是函数

转载 作者:行者123 更新时间:2023-12-04 23:18:37 24 4
gpt4 key购买 nike

我刚刚开始使用 Yeoman 搭建一个新的 Angular 应用程序。我遵循了 generator-angular 处的安装指南但选择使用 gulp 而不是 grunt 作为任务运行器。

安装后我收到错误:task 'wiredep' is not in you gulpfile .

我尝试使用 gulp 运行构建并收到错误:TypeError: $.useref.restore is not a function
如果我运行 gulp serve ,生成的页面不会连接依赖项。

上面的错误有解决办法吗?

我注意到 Yeoman 使用了 grunt,并且 gulp 是实验性的,所以我猜上面的错误是意料之中的。我应该在生成器的 GitHub 页面上将其作为问题发布吗?

最佳答案

里面的问题很少。

第一期 yeoman 指的是 gulp wireep 而不是 gulp bower:
重命名 gulp.task('bower', function (){ gulp.task('wiredep', function () {
第二个问题是凉亭库不在 directory: yeoman.app + '/bower_components' 中,但在 directory: 'bower_components' ,

第三期 .pipe(gulp.dest(yeoman.app + '/views'));不在 View 文件夹中,而是在 .pipe(gulp.dest(yeoman.app ));
长话短说,替换 gulp.task('bower', function ...和:

gulp.task('wiredep', function () {
return gulp.src(paths.views.main)
.pipe(wiredep({
directory: 'bower_components',
ignorePath: '..'
}))
.pipe(gulp.dest(yeoman.app ));
});

删除dist文件夹,运行 gulp wiredep , gulpgulp serve或将wiredep 任务添加到构建任务中。

希望这能澄清它。

关于gulp - Yeoman generator-angular : 'task wiredep' is not in gulpfile & $. useref.restore 不是函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33459298/

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