Bower
PhpStorm integrates with the Bower Package Manager so you can install, locate, upgrade, and remove client-side libraries and components that contain HTML, CSS, JavaScript, fonts, image files, etc. without leaving the IDE. The Bower page provides a dedicated UI for managing packages. Of course, you can also do that from the command line in the built-in Terminal.
Installing and configuring Bower
To install Bower
Open the built-in PhpStorm Terminal (Alt+F12) and type
npm install -g bower
at the command prompt.
To create bower.json
Open the embedded Terminal ( or Alt+F12).
At the command prompt type:
cd <your project folder> bower init
- Answer the questions to specify the following basic settings:
The testing framework to use.
The browsers to be captured automatically.
The patterns that define the location of test files to be involved in testing or excluded from it.
To configure Bower in WebStorm
In the Settings/Preferences dialog (Ctrl+Alt+S), click JavaScript under Languages and Frameworks, and then click Bower. The Bower page opens.
Specify the Node.js interpreter to use. This can be a local Node.js interpreter or a Node.js on Windows Subsystem for Linux.
Specify the location of the Bower package and the
bower.json
configuration file.
Managing Bower packages
Bower installs packages only as project dependencies or development dependencies, learn more from the Bower Official website. You can manage Bower packages on the Bower page or in the Terminal tool window.
To install a package in the Terminal
Open the embedded Terminal ( or Alt+F12).
At the command prompt, type
bower install --save <package_name>
orbower install --save-dev <package_name>
to install the package as a project dependency or a development dependency.
To handle packages on the Bower page
In the Settings/Preferences dialog (Ctrl+Alt+S), click JavaScript under Languages and Frameworks, and then click Bower.
- On the Bower page that opens, the Packages area shows all the Bower packages that are currently installed in your project.
To install a package, click , and in the Available Packages dialog box that opens, select the required package and click Install Package.
To upgrade to the latest version of a package, select it in the list and click .
To uninstall a package, select it in the list and click .