How can I move bower libraries in ASP.NET Core?

杀马特。学长 韩版系。学妹 提交于 2019-12-02 04:56:22

问题


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"
}

When I restore bower packages I'm left with this:

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?


回答1:


You can use gulp task runner to move bootstrap folder into lib folder.

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/'));
}); 

Then right click gulpfile.js, select Task Runner Explorer, run the copy-bootstrap task or set Bindings to Before Build .



来源:https://stackoverflow.com/questions/38259425/how-can-i-move-bower-libraries-in-asp-net-core

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!