2015-05-29 71 views
1

在ASP.NET 5应用程序中尝试使用Bower安装客户端软件包时遇到问题。我定义了一些包我要安装到我的应用程序在bower.json文件,像这样:Bower安装了未在bower.json中定义的组件到asp.net 5应用程序

{ 
    "name": "bower", 
    "license": "Apache-2.0", 
    "private": true, 
    "dependencies": { 
    "jquery": "1.11.2", 
    "modernizr": "2.8.3", 
    "bootstrap": "3.3.4", 
    "jquery.uniform": "2.1.2", 
    "fluidbox": "1.4.3", 
    "owl-carousel": "1.3.2", 
    "photo.swipe": "4.0.8", 
    "magnific-popup": "1.0.0", 
    "slippry": "1.2.9", 
    "fastclick": "1.0.6", 
    "imagesloaded": "3.1.8", 
    "jquery-validate": "1.13.1", 
    "fitvids": "1.1.0", 
    "jquery-gridrotator": "0.1.0" } 

保存后,我在隐藏bower_components看到文件夹中有我没有一些其他的包在bower.json文件中定义的,就像这样:

enter image description here

运行繁重的任务后,我看到了安装到我的应用程序的一些奇怪的包。

enter image description here

我简单gruntfile.js

module.exports = function (grunt) { 
    grunt.initConfig({ 
     bower: { 
      install: { 
       options: { 
        targetDir: "wwwroot/lib", 
        layout: "byComponent", 
        cleanTargetDir: true 
       } 
      } 
     } 
    }); 

    grunt.registerTask("default", ["bower:install"]); 

    grunt.loadNpmTasks("grunt-bower-task"); 
}; 

所以,我怎么只能安装到我的ASP.NET 5应用程序包我想要什么?非常感谢。

+0

'imagesloaded'似乎取决于'eventie'和'eventEmitter',这样解释这两个,但我无法从新的Web项目开始重新生成其他额外软件包的问题。 –

回答

0

它们是由例如砌体凉亭安装依赖使用这种依赖关系

{ 
    "name": "masonry", 
    "version": "3.3.0", 
    "description": "Cascading grid layout library", 
    "main": "masonry.js", 
    "dependencies": { 
    "get-size": "~1.2.2", 
    "outlayer": "~1.4.0", 
    "fizzy-ui-utils": "~1.0.1" 
    } 
} 

我建议你使用DEST,js_dest,css_dest和font_dest按类型的文件分割,并设置选项keepExpandedHierarchy假的东西这样

  { 
       dest: "wwwroot/lib", 
       js_dest: "wwwroot/lib/js", 
       css_dest: "wwwroot/lib/css", 
       fonts_dest: "wwwroot/lib/font", 
       options: { 
        keepExpandedHierarchy: false 
       } 
      } 

,并使用像includeSource一些模块来增加您的CSHTML文件中的所有文件

includeSource: { 
      layout: { 
       files: { 
        'Views/Shared/_Layout.cshtml': 'Views/Shared/_Layout.cshtml' 
       } 
      }, 
      options: { 
       basePath: "wwwroot/lib/js", 
       baseUrl: '~/lib/', 
      } 
     } 

,你必须在你的页面

<!-- include: "type": "js", "files":"**/*.js", "ordering": "top-down" --> 
    <!-- /include --> 

添加标记希望它有助于