Resource paths now resolved relative to html file - #1
Conversation
sri generation failed in my case where I had complex directory structure like this:
`
myApp
|-- gulpfile.js
|-- core
| |-- scripts
| | `-- main.js
| |-- styles
| | `-- main.css
| `-- index.html
`-- hosts
|-- electron
| |-- scripts
| | `-- main.js
| `-- index.html
`-- webapp
|-- scripts
| `-- main.js
`-- index.html
`
Upon debugging `index.js` I found paths to resources were being resolved relative to `gulpfile` or `cwd` (not sure). After this patch they are now resolved relative to `html` file in question.
Current coverage is 100% (diff: 100%)@@ master #1 diff @@
===================================
Files 1 1
Lines 61 61
Methods 0 0
Messages 0 0
Branches 0 0
===================================
Hits 61 61
Misses 0 0
Partials 0 0
|
|
@NeekSandhu, yes you're absolutely right. It's an undocumented "intended behavior" for folder structures like the one below (so no matter how deep html files are nested, referencing In order to accommodate to your use case, I'll make some modifications, and introduce a configurable option If you have the time, please test it out (either from git, or wait until v1.2.0 release is out). |
|
Great, sounds good. But just out of curiosity, what kind of project uses the structure you mentioned? I've never seen that before. In my case its because my app is delivered through iframe in browser and webview in electron. |
|
It's a result of using static site generators, e.i. Hugo, which will create nested folder structures containing 'index.html' files. |
sri generation failed in my case where I had complex directory structure like this:
Upon debugging
index.jsI found paths to resources were being resolved relative togulpfileorcwd(not sure). After this patch they are now resolved relative tohtmlfile in question.