{ "name": "ASP。 NET”,“private”:true,“dependencies”:{“bootstrap”:“3 . 3 . 4”,“jquery”:“ 1. 10.2”, “jquery-validation”:“ 1. 1 1. 1”,“jquery-validation-obtructive”:“3 . 2 . 2”,“hammer . js”:“2 . 0 . 4”,“bootstrap-touch-carousel”:“0 . 8 . 0”,“0”
}
}
After adding this line, save the bower.json file, and VS will automatically restore the package of MetroUI. Expand the Bower node under the dependencies node in the project, and you will see the metro (3.0.5) node. Depending on the network situation and the size of the software package, it may take some time until the word "Not Installed" behind this node disappears, indicating that the software package has been successfully restored. If there is a problem with automatic recovery, you can also click this node and select "Update Package" from the right-click menu.
The installation package is just downloaded to the corresponding folder of the "bower_components" folder in the project folder. You also need to copy the published files of the package to the lib directory through task executors such as Gulp or Grunt (the lib directory is based on the habit of VS, and you can also choose other directories). Since VS uses Gulp as the default project template, open the gulpfile.js file and find the task "copy". In the gazebo, add a copy description. Since the release files of MetroUI are placed in two folders, namely "build" and "fonts", it takes a little skill to write a copy description to handle the copies of multiple folders. See the following code:
var bower = { " bootstrap ":" bootstrap/dist/* */*。 {js,map,css,ttf,svg,woff,eot},“bootstrap-touch-carousel”:“bootstrap-touch-carousel/dist/* */*。 {js,css},“hammer . js”:"hammer.js/hammer*。 {js,map},“jquery”:“jquery/jquery *。 {js, map}、" jquery-validation ":" jquery-validation/jquery . validate . js "、" jquery-validation-obtrusted ":" jquery-validation-obtrusted/jquery . validate . obtrusted . js "、" metro": "metro/build/**/*。 {js,map,css},“metro/fonts”:“metro/fonts/*。 {ttf,svg,woff,eot} "
}
After improving the Gulp task code, you also need to perform a copy task to copy metro's published files to a specific folder under wwwroot (in this case, lib). Gulp tasks can be executed manually in Task Runner Explorer or automatically by compiling solutions or projects.
Finally, after the front-end library is installed, it is referenced in HTML or view files, and I won't repeat the specific writing.
It should be said that the front-end development modes of VS 20 15 and ASP.NET 5 not only keep the routine practices popular in the industry now, but also give full play to the powerful IDE function of Visual Studio, which is convenient for everyone to add front-end libraries.