What do I have to change in my webstorm IDE that the bootstrap classes are recognized when I do:
<a class="btn btn-primary" />
At the moment I have always to re-check the class names by looking into the bootstrap css files. Thats not so nice...
What do I have to change in my webstorm IDE that the bootstrap classes are recognized when I do:
<a class="btn btn-primary" />
At the moment I have always to re-check the class names by looking into the bootstrap css files. Thats not so nice...
I had the same problem and finally fixed it!! You need to download the Bootstrap library LOCALLY.
This worked:
<link rel="stylesheet" href="./css/css/bootstrap-theme.min.css" >
But this didn't work:
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css">
Cheers, JJ
For a quick-fix, downloading the bootstrap.min.css
or whichever you are using locally, and then referencing it like
<link href="stylesheets/bootstrap.min.css" rel="stylesheet">
solves the problem.
I think another way for WebStorm to be able to autocomplete without referring to it locally would be to add the file as an external library
Finally I got the solution:
For me the problem is the way i referenced the css files.
My file structure :
Project
/App
-index.html
/bower_components
/bootstrap
/dist
/css
-bootstrap.css
and i referenced them like so :
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="bower_components/bootswatch/superhero/bootstrap.min.css" />
The css was applied but no intellisence was provided. I think the css was applied due to my .bowerrc file.
{
"directory": "bower_components"
}
I changed the path to the relative one and webstorm recognized my bootstrap classes.
<link rel="stylesheet" href="../bower_components/bootstrap/dist/css/bootstrap.min.css" />
<link rel="stylesheet" href="../bower_components/bootswatch/superhero/bootstrap.min.css" />
If you are using style tag in your PHP
page, it prevents loading CSS
class code completion.
Put your styles into CSS
file then load it and remove style tag.
I had to mark my styles directory, which contains my css, as "Resources" in module settings. I also had to mark my bower components and node module directories as "Sources".
To add stylesheets to your global JS libraries:
+
button just above Documentation URLs and select Attach Files...The stylesheet is now attached to the global JS library, so you will get CSS code completions/recommendations from the stylesheet whenever you include the JS library for a project in the IDE.
Make sure it is turned on. Do the following in WebStorm:
File | Settings | IDE Settings | Editor - Code Completion
Or:
File | Settings | Type in the search bar "code completion"
The second option will take you straight to the code completion options if in some case you could not find it via the first way.
More information can be found here