Gulp + Bower support in VS2015 for an upgraded project

陌路散爱 提交于 2019-12-13 01:28:29

问题


I'm basically trying to figure out what I need to do, to make an MVC project (created in Visual Studio 2013) to behave like a fresh MVC project created directly in Visual Studio 2015.

What I've noticed is that I see more interesting things in Visual Studio 2015 with a newly created project, and I'm sure some of these would be useful, but I can't figure out the magic to get them enabled. I've tried doing some googling but unfortunately keep finding tutorials for VS2013 support which isn't what I'm after, I specifically want to leverage the new VS2015 features. Things that I've spotted so far:

Dependencies

How do I enable the dependency view? I've tried copying a bower.json file from a new project, but even after a restart in VS2015 I don't get this dependencies tracker.

Task Runner

How do I enable the task runner? I tried creating a Gulpfile.js but I get an error in the output window gulp is not recognized as an internal or external command. I don't get this in a brand new solution, but it reads as though gulp isn't installed on my machine?


回答1:


How do I enable the dependency view?

This isn't possible; the Dependencies node is part of the DNX project system and is only available in new projects.

How do I enable the task runner?

In addition to adding the gulpfile, you must add a package.json file, and add "gulp" to its devDependencies section. Other tools you'll be using in Gulp should be added here as well. You can use a new ASP.NET 5 project as an example.

You may want to add a bower.json file as well. Bower components will be downloaded to a bower_components folder, which will be hidden by default in the old project system. Adding Bower.json from the New Item template will also add a .bowerrc file that moves the package download location to wwwroot/lib. Probably not what you want for the MVC project; you could change this to just lib instead, or delete the .bowerrc. While the hidden bower_components folder is harder to work with, it's omitted from checkin in git, which is probably what you want.



来源:https://stackoverflow.com/questions/32716983/gulp-bower-support-in-vs2015-for-an-upgraded-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!