!! Important: PATH to assets !

Hi there.

Using javascript inside BS for several purposes i had to notice, that the behaviour of BS with e.g. images in this case causes huge problems.

But I add a workaround in this Post.

Usual procedure:
Adding images as described by drag and drop or with the Import-Function and place it as usual into the Project.

The HTML-attributes within BS will be shown as img src="/picture.png" id="pictue""/\

So far so good:
Using the BS-Preview Function in the Browser and also export and loading the Website from the Server works as expected.

BUT - And here begins the IMPORTANT PROBLEM ! :

If you are including javacript to modify the Image, in my Case changing the Image, when the Status is changed you have either problem:

  1. Using the same declaration for the javascripts like BS src="/picture.png"

* In BS Preview Mode: Everything works well * Exporting the Project and loading it from the Server, the Dev-Console of the Browser reports Wrong-Path-To-Images

  1. Modifiying the javascripts to src="/assets/img/picture.png"

* In BS Preview Mode: Browser-Dev-Console reports wrong Path-2-Images * Exporting the Project and loading it from the Server: Everything works well

This Failure is reulted in the way, BS handles Ressources. When exporting the Images and others it creates Subfolders on the Webserver

e.g.: https:/ /www.YourBSProjectServer.tld/assets/img/picture.img


Hope BS-Team soon finds a solution to either

  • modify the improrted or created javascripts to add the path when exporting
  • use an internal modification in the BS-Preview Server for the requests - e.g. remove /assets/img if present
  • provide a pre-defined export-script for consolidate the path's and/or move files - but this seems to be complex

The Workaround:

  • I have written a short snippet in the 1st. javascript file that like: var imgurl = ""; if (!(window.location.hostname === "{Your-BS-Host-IP-Address")){ imgurl = window.location.pathname + "assets/img/"; }
    (The ip-address will likely be the address which you choosed when starting BS-Preview Server - some like "" or "192.168..x.y" - whatever your network uses and you selected as Server-Address.
  • you may create an -htacces file on your Webserver modifying the request that way, it adds /assets/img if not present
    example: RewriteEngineOn RewriteRule ^.jpg$ /assets/img/.jpg$
    This snippet is a Qucikshot and not tested - you may find usefull information about howto create .htacces in the net.

OK, hope this will be solved inside BS soon ;-)

Kind Regards


in javascript you would then use somelike as <br><br> src = imgurl + "picture.png";<br><br> which will result in<br><br> /assets/img/picture.img<br><br> to extend the path when loading with relative path from server.

Thank you for posting this!

I experienced the same error with the path of the images after a change, I'm glad you posted this.