ASP.NET 5 Client Side Depdency Management - Bower

后端 未结 1 1180
孤独总比滥情好
孤独总比滥情好 2021-01-20 21:36

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.

But I have a question: Whe

相关标签:
1条回答
  • 2021-01-20 22:13

    I have recently been playing in this space and following is something that I have tried:

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

    4. Added a postrestore step to your application's project.json file "scripts": { "postrestore": "gulp copyMainFiles", "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ] }

    5. 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:

      "overrides": { "jquery": { "main": [ "dist/jquery.js", "dist/jquery.min.js" ] }, "hammer.js": { "main": [ "hammer.js", "hammer.min.js" ] }, "bootstrap": { "main": [ "./dist/js/bootstrap.js", "./dist/js/bootstrap.min.js", "./dist/css/bootstrap.css", "./dist/css/bootstrap.min.css" ] } }

    6. Finally had to update the jquery-validation package to use 1.14.0 instead of 1.11.1 as the previous version does not dist folder and indeed no bower.json...

    image

    0 讨论(0)
提交回复
热议问题