How to set html root directory
Hi,
i'm using intellij 2016.3.1
I've got a nodejs project with backend in ./app and the frontend-files in ./public.
the express-server will serve ./public as /
lets say i have these to files:
./public/index.html
and
./public/logo.png
so i can access the index.html via /index.html or /
and the logo.png via /logo.png
My problem is:
in my index.html i hav an image.tag:
<img src="/logo.png" />
intellij will not help me to autocomplete the path to the image since according to intellij it's path is /public/logo.png.
also it highlights the path to tell me that it cant resolve the path.
I've searched the forum and tried to mark ./public as a Ressource-Root, but that didn't help.
is there any way to tell indellij that ./public is my web-root?
Please sign in to leave a comment.
Works for me when using either 'sources' or 'resources' roots:
if it doesn't work for you, can you provide a project that shows up the issue?
so, the problem seems to be a bit more complicated.
the public folder is generated via gulp (less to css, images otimized uglify etc). if i mark the src-folder of these files as either Ressource or source root, it works just fine. except these are the wrong files :)
i discovered that the public fulders name in the project-view is darker, the same color as the node_modules folder, but i did not marke it as ignore ore something. does intellij somehow magically detect that this folder is autogenerated and handles it differently?
If the color is the same as the one for node_modules, it's most likely excluded. Please right-click this folder - what do you see in its menu?
i thought about that, but didn't find an option to ignore
my right-click-menu on this folder: (sorry, can'T take a screenshot while context-menu is up...
New > [a bunch of file-types]
Cut
Copy
Copy Path
Copy as Plain Text
Copy Relative Path
Pase
----
Find Usage
Find in Path...
Analyze >
----
Refactor >
Clean Python Compiled Files
----
Add to Favorites >
Show Image Thumbnails
----
Reformat Code
Optimize Imports
Delete...
Build Modules '$PROJECTNAME'
----
Local Hostory >
Synchronize '$FOLDERNAME'
----
Show in Caja (my filemanager)
----
Directory Path
----
Compare with...
----
Mark Directory as >
None of these are active. exclude is active for node_nodules.
----
Create Gist...
----
WebServices >
Hmm.. Please attach a screenshot of your project tool window, so that I can see the colors; screenshot of Project Structure, Modules would be also helpful
and, BTW, what is your module type? please inspect your .iml file, "<module type...>"
Sure, here you go:
http://storage4.static.itmages.com/i/16/1223/h_1482501568_4069859_629e309f5e.png
it's the dist folder, used public just to make things easyer in the first post.
Thanks so long :)
it's JAVA_MODULE.
i've not chosen it, i've just opened that folder via open...
can't recreate even using JAVA_MODULE... And my colors look different from yours:
Seems I still need your project. Also, do you have any custom plugins installed? .ignore, etc.? Don't understan where your colors come from...
.ignore was the key.
i have a global gitignore file filled with stuff from www.gitignore.io. it lists dist as a common folder for grunt.
I''m not sure that i like the idea of having my gitignored files not in autocomplete, but that needs to be discussed with the autor of .ignore.
There is just one little thing that nags me:
i can now autocomplete the path dist/logo.png, but not /dist/logo.png.
in this particular case that's fine, i'l just use a relative path, but for templates that may break stuff.
But hey, i'll can easily add that slash after autocompleting my path.
Thanks for your support.