如何在 ASP.NET Core 中移动 Bower 库? [英] How can I move bower libraries in ASP.NET Core?
问题描述
在我的 wwwroot
文件夹中,我有两个名为 lib
和 lib_bower
的子文件夹.我的 lib_bower
文件夹设置在我的 .bowerrc
文件中,如下所示:
In my wwwroot
folder I have two subfolders called lib
and lib_bower
. My lib_bower
folder is setup in my .bowerrc
file like so:
{
"directory": "wwwroot/lib_bower"
}
当我恢复 bower 包
时,我只剩下这个:
When I restore bower packages
I'm left with this:
如果找不到文件,我想在构建时将整个 dist
文件夹从 bootstrap
移动到我的 lib
文件夹中.我该怎么做?
I'd like to move the entire dist
folder from bootstrap
into my lib
folder when I build if the files are not found. How can I do this?
推荐答案
您可以使用 gulp
任务运行器将 bootstrap 文件夹移动到 lib 文件夹中.
You can use gulp
task runner to move bootstrap folder into lib folder.
配置代码(gulpfile.js):
Configuration code(gulpfile.js):
var gulp = require('gulp');
gulp.task('default', function () {
// place code for your default task here
});
var paths = {};
paths.webroot = "wwwroot/";
paths.bowerSrc = "./wwwroot/lib_bower/";
paths.lib = paths.webroot + "lib/";
gulp.task("copy-bootstrap", function () {
return gulp.src(paths.bowerSrc + '/bootstrap/dist/**/*.*', { base: paths.bowerSrc + '/bootstrap/dist/' })
.pipe(gulp.dest(paths.lib + '/bootstrap/'));
});
然后右击gulpfile.js
,选择Task Runner Explorer
,运行copy-bootstrap
任务或设置Bindings
code> 到 Before Build
.
Then right click gulpfile.js
, select Task Runner Explorer
, run the copy-bootstrap
task or set Bindings
to Before Build
.
这篇关于如何在 ASP.NET Core 中移动 Bower 库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!