How to add css to javascript library in IDEA IDE?
I use Idea IDE for web project with extjs javascript framework. Extjs is shipped with sets of css files, which are need for this framework to function properly. I learned how to make javascript libraries in Idea IDE, but didn't manage to understand how to add there css files as IDE wizard only allow to add .js files. Then my question is - How to add css to javascript library in IDEA?
IMHO - the function of making javascript libraries without css is quite useless.
Please sign in to leave a comment.
It's simply a case that there is no (built-in) template for CSS files. To create a CSS file, just select New | File from the context menu and create a file with a .css extension. If you want to create a template, you can go to Settings (Ctrl+Alt+S) | File Templates and create your own. (Alternatively, you can select "Edit File Template" from the Project tool window's context menu.) Once you create the template, it will appear in the project window's context menu under "From File Template..." In the pop-up, select your template, or click the browse button ("...") to select it. Once you use a template, it will show in the Project tool window's context menu directly.
Well, Mr. Mark Vedder, you misunderstand me completely.
I don't need any templates for CSS files. I asked if I have an opportonity to make javascript library in Idea IDE with JS an CSS files in it, as EXTJS framework, which I have to use, needs for their proper functionality. IntelliJ IDEA indeed provides the possibility to set up custom JavaScript libraries for Debug or Release production but only for .js files. EXTJS has JS and CSS files and I need all of them when make my custom JavaScript library. Right now I only know how to add to the custom JavaScript library only JS files.
I hope that now I clearly expressed the issue.
Peter,
currently there is no way to add a CSS file to JS library. JS library files are used in code completion and navigation for other (project) JS files. Do you mean that you want a similar functionality for CSS? In any case you are welcome to submit a feature request at http://youtrack.jetbrains.net.
I'd like to use Javascript libraries as I use pure Java libraries.
For a example, configure global javascipt library with js, css, image files and so on. Add it to artifacts and deploy to the Web server.
# **To add stylesheets to your global JS libraries:**
1. Open the IDE `Preferences` menu and go to `Languages & Frameworks > JavaScript > Libraries`
2. Select the library you wish to add a stylesheet to and click `Edit...` on the right-hand side
3. Click the `+` button just _**above**_ `Documentation URLs` and select `Attach Files...`
4. Find and select the stylesheet you wish to add, then click `OK` to close the "Edit Library" dialogue
The stylesheet is now attached to the global JS library, so you will get CSS code completions/recommendations from that stylesheet whenever you include that JS library for a project in the IDE.
### It would be nice if JetBrains would automate this process by providing an easy option to Download CSS files from CDN links and save them as global libraries like it does for JS files.
@Turret24
Feel free to create a feature request on YouTrack:
https://youtrack.jetbrains.com/issues/IDEA