2015-05-29 27 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 --> 

添加標記希望它有助於