问题描述
我想出来的新ASP.NET与5 MVC 6,和我使用的凉亭来管理我的所有客户端的依赖性。一切工作正常。
I'm trying out the new ASP.NET 5 with MVC 6, and I'm using bower to manage all my client-side dependencies. Everything is working fine.
不过,我有一个问题:当我添加一个依赖(比如说jQuery的)。它增加了两个 / DIST
和 / src目录
带凉亭的配置文件复制到 / lib下沿
的wwwroot
的文件夹中。我如何使它包括只为使用的编译源? (所以,我可以通过 /lib/jquery/jquery.js
?
But I have a question: When I add a dependency (let's say jQuery). It adds both the /dist
and /src
along with bower configuration files to the /lib
folder of wwwroot
. How do I make it include just the compiled source for usage? (So I can reference it in my pages via /lib/jquery/jquery.js
?
推荐答案
我最近一直在这个空间里玩,下面是一些我曾尝试:
I have recently been playing in this space and following is something that I have tried:
- 删除了
.bowerrrc
文件,以便能够在默认安装bower_components
下的项目文件夹,而不是文件夹下wwwroor \\ lib中
的东西在的wwwroot
往往变得公布。 - 新增
主亭子档案:2.9.0
到的package.json
。这个软件包被提到的所有文件中的主
每个已安装包的bower.json
文件的属性。 -
创建使用上述包一饮而尽任务
gulp.task('copyMainFiles',函数(){
返回gulp.src(mainBowerFiles(){基地:bower_components'})
.pipe(gulp.dest('wwwroot的/ lib目录'));
});
- Deleted the
.bowerrrc
file to enable installing in the defaultbower_components
folder under the project folder rather than underwwwroor\lib
as anything underwwwroot
tends to get published. - Added
"main-bower-files": "2.9.0"
topackage.json
. This package gets all the files mentioned in themain
property of each installed package'sbower.json
files. Created a gulp task using the above package
gulp.task('copyMainFiles', function () { return gulp.src(mainBowerFiles(), { base: 'bower_components' }) .pipe(gulp.dest('wwwroot/lib'));});
新增了还原后
步到应用程序的 project.json
文件
脚本:{
还原后:一口copyMainFiles
prepublish:故宫安装,亭子安装,大口喝干净,吞掉分钟]
}
Added a postrestore
step to your application's project.json
file"scripts": { "postrestore": "gulp copyMainFiles", "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ]}
更新未在主
(如一些上市我的应用程序的 bower.json
复制文件包不具有分文件作为主要files..ex:jQuery的)。下面设置由主亭子-文件
阅读:
Updated my application's bower.json
to copy files which are not listed in main
(like some packages do not have min files as main files..ex: jQuery). The following settings are read by main-bower-files
:
覆盖:{
jQuery的:{
主:DIST /的jquery.js,DIST / jquery.min.js]
},
hammer.js:{
主:hammer.js,hammer.min.js]
},
引导:{
主:
./dist/js/bootstrap.js
./dist/js/bootstrap.min.js
./dist/css/bootstrap.css
./dist/css/bootstrap.min.css
]
}
}
这篇关于ASP.NET 5客户端Depdency管理 - 鲍尔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!