Auto-complete and resource location challenges with development vs. runtime

I have a NodeJS project and I'm having problems with the difference in resource locations during development and during run time.  

 

To help exemplify: here is my folder structure:

/public

/public/lib/bootstrap/dist/css/

/views

/views/index.html

In order to get auto-complete, inside of my index.html, I have to reference the bootstrap.css using the development path, e.g.:

<link rel="stylesheet" href="../public/lib/bootstrap/dist/css/bootstrap.css" />

However, during runtime, I use NodeJS/Express to map /lib to ../public/lib/ e.g. the path to the bootstrap from index.html is /lib/bootstrap not ../public/lib/bootstrap.

Due to this issue, I can either have auto-complete during design time, and then the app is broken, or auto-complete is broken and the run time application works.  

I'm sure there is some simple way to solve this to tell the IDE that /lib/bootstrap is ../public/lib/bootstrap during design time - I'm quite new to IntelliJ.

I am using 2016.1.1 of IntelliJ Ultimate with the WebStorm plugin.

TIA

1 comment

Hi there,

I do not know about IntelliJ .. but in WebStorm you can mark your "public" folder as Resource Root and use paths relative to that folder:

<link rel="stylesheet" href="/lib/bootstrap/dist/css/bootstrap.css" />
0

Please sign in to leave a comment.