Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Bower (installed from nuget) in Visual Studio?

I am trying to use bower inside Visual Studio 2013.

First I installed bower (not bower.js) via nuget's Package Manager Console.

Then I thought I could simply type

PM> bower init

inside the PMC to generate the bower.json.

But then it gave me this error.

bower : The term 'bower' is not recognized...

PS. The path of the PM> is pointing to C:\MyWebProject\MyWebProject\.bin.

What am I missing here??

like image 395
Justin XL Avatar asked Oct 23 '14 05:10

Justin XL


People also ask

What is Bower in Visual Studio?

Bower is a “package manager for the web.” Bower lets you install and restore client-side packages, including JavaScript and CSS libraries. For example, with Bower you can install CSS files, fonts, client frameworks, and JavaScript libraries from external sources.

Is Bower still used?

Bower has been deprecated. It is still being maintained for those who still use it.

How do you add Bower components to a project?

To add a new Bower package to your project you use the install command. This should be passed the name of the package you wish to install. As well as using the package name, you can also install a package by specifying one of the following: A Git endpoint such as git://github.com/components/jquery.git.


2 Answers

  1. Open the command prompt
  2. Navigate to web project folder
  3. Run bower init
  4. You should have bower.json created by answering all answers on the cmd prompt.
like image 185
Srinivas Paila Avatar answered Sep 30 '22 04:09

Srinivas Paila


Srinivas accurately described the steps needed to get you started with a bower.json in your root folder, which is where you want to start. You now have two main tasks:

  1. Define dependencies - use Package Intellisense.
  2. Install dependencies - use Grunt Launcher. They will be installed to the bower_components folder.
  3. Reference dependencies - simply add them to you project (as links).

For more information see Introducing Gulp, Grunt, Bower, and npm support for Visual Studio.

Note that Visual Studio 2015 (currently in preview) has built-in, first-class support for all of the above: Manage Client-Side Web Development in Visual Studio 2015, Using Grunt and Bower.

like image 23
Ohad Schneider Avatar answered Sep 30 '22 04:09

Ohad Schneider