emi
emi

Reputation: 2950

Referencing a parent directory in HTML

As far as references to directories are concerned, I understand

./ = current
../ = parent

But I am having a problem referencing my bower_components directory in this bit of HTML code. The reference to the lib folder works fine but not bower_components. What am I missing?

main.html

<!DOCTYPE html>
<html>
    <head>
    </head>
    <body>
        <script src="lib/jquery/dist/jquery.min.js"></script>
        <script src="../bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
    </body>
</html>

Directory structure looks like this: enter image description here

Upvotes: 2

Views: 6507

Answers (2)

Xu Lei
Xu Lei

Reputation: 5

Maybe you can try this:

<script src="contacts/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>

Just use the full script path

Upvotes: 0

Faxn
Faxn

Reputation: 376

Try going to <your server>/bower_components/bootstrap/dist/js/bootstrap.min.js

It probably won't work. If your server setup is normal only public and the folders below it are accessible from the client side. From the client point of view public is the root, there is nothing above that.

As for importing bootstrap, see if you can browse what node is making available in your browser. It's probably hosting the scripts you need to reference on the client side at another url. You might also find the url in the bower documentation/examples.

You could solve this by copying or symlinking the scripts into the public directory, but that would be a bit hackish, save it for if you get completly fed up with finding the intended way.

Upvotes: 2

Related Questions