ASP.NET 5客户端Depdency管理 - 鲍尔 [英] ASP.NET 5 Client Side Depdency Management - Bower

查看:150
本文介绍了ASP.NET 5客户端Depdency管理 - 鲍尔的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想出来的新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:


  1. 删除了 .bowerrrc 文件,以便能够在默认安装 bower_components 下的项目文件夹,而不是文件夹下 wwwroor \\ lib中的东西在的wwwroot 往往变得公布。

  2. 新增主亭子档案:2.9.0的package.json 。这个软件包被提到的所有文件中的每个已安装包的 bower.json 文件的属性。

  3. 创建使用上述包一饮而尽任务

    gulp.task('copyMainFiles',函数(){
        返回gulp.src(mainBowerFiles(){基地:bower_components'})
                         .pipe(gulp.dest('wwwroot的/ lib目录'));
    });

  1. Deleted the .bowerrrc file to enable installing in the default bower_components folder under the project folder rather than under wwwroor\lib as anything under wwwroot tends to get published.
  2. Added "main-bower-files": "2.9.0" to package.json. This package gets all the files mentioned in the main property of each installed package's bower.json files.
  3. 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管理 - 鲍尔的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆