Yeoman generator-angular:'task wiredep'不在gulpfile& $ .useref.restore不是一个函数 [英] Yeoman generator-angular : 'task wiredep' is not in gulpfile & $.useref.restore is not a function
问题描述
我刚开始使用Yeoman来搭建一个新的Angular应用程序。我遵循发电机角度的安装指南,但选择使用gulp而不是grunt作为任务执行者。
安装后我收到错误:任务'wiredep'不在你的gulpfile
中。
我尝试使用 gulp
运行构建并收到错误: TypeError:$ .useref.restore不是函数
如果我运行 gulp serve
,结果页面不会连接依赖关系。
是否修复了上述错误?
我注意到Yeoman使用咕噜声,实验,所以我猜想上面的错误是可以预料的。我应该在发生器的GitHub页面上将它作为问题发布吗?
这里有几个问题。 b
$ b
第一个问题yeoman指的是gulp wiredep而不是gulp bower:
rename gulp.task('bower',function()
to {gulp.task('wiredep',function(){
第二个问题是,不在目录中:yeoman.app +'/ bower_components'
,但在目录中:'bower_components'
p>
第三期 .pipe(gulp.dest(yeoman.app +'/ views'));
不在views文件夹,但 .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:'..'
}))
.pi pe(gulp.dest(yeoman.app));
});
删除dist文件夹下运行 gulp wiredep
, gulp
和 gulp serve
或者将Wiredep任务添加到构建任务中。
希望能够澄清它。
I've just started using Yeoman to scaffold a new Angular app. I followed the installation guide at generator-angular but chose to use gulp instead of grunt for the task runner.
After installation I received error : task 'wiredep' is not in you gulpfile
.
I tried running the build using gulp
and received error : TypeError: $.useref.restore is not a function
If I run gulp serve
, the resulting page does not wire dependencies.
Is there a fix to the errors above?
I noticed that Yeoman uses grunt, and that gulp is experimental, so I guess the above errors are expected. Should I post it as an issue at the generator's GitHub page?
There are few issues in there.
1st issue yeoman is referring to gulp wiredep not gulp bower:
rename gulp.task('bower', function ()
to { gulp.task('wiredep', function () {
2nd issue is that bower libs are not in the directory: yeoman.app + '/bower_components'
, but in directory: 'bower_components'
,
3rd issue .pipe(gulp.dest(yeoman.app + '/views'));
is not in the views folder but the .pipe(gulp.dest(yeoman.app ));
So long story short, replace gulp.task('bower', function ...
with:
gulp.task('wiredep', function () {
return gulp.src(paths.views.main)
.pipe(wiredep({
directory: 'bower_components',
ignorePath: '..'
}))
.pipe(gulp.dest(yeoman.app ));
});
Delete the dist folder, run gulp wiredep
, gulp
and gulp serve
or add wiredep task to the build one.
Hope this clarifies it.
这篇关于Yeoman generator-angular:'task wiredep'不在gulpfile& $ .useref.restore不是一个函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!