Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!
  • Guest, before posting your code please take these rules into consideration:
    • It is required to use our BBCode feature to display your code. While within the editor click < / > or >_ and place your code within the BB Code prompt. This helps others with finding a solution by making it easier to read and easier to copy.
    • You can also use markdown to share your code. When using markdown your code will be automatically converted to BBCode. For help with markdown check out the markdown guide.
    • Don't share a wall of code. All we want is the problem area, the code related to your issue.


    To learn more about how to use our BBCode feature, please click here.

    Thank you, Code Forum.

HTML Help with paths

chrisj

Bronze Coder
I am testing an index.html file that works successfully inside a folder named 'require-js' which is inside the main folder named Main.
like so: Main/require-js/index.html. I've moved the 'require-js' folder from the Main folder into public_html/, and the index.html no longer succeeds,
so I played around with this path '../dist/draggabilly.pkgd' thinking that is the issue, but no success. Any help is appreciated.



HTML:
<!--<script src="/main.js" type="text/javascript"></script>-->
<script>
/* globals requirejs */
requirejs( [ '../dist/draggabilly.pkgd' ], function( Draggabilly ) {
new Draggabilly('.draggie');
} );
</script>
<script data-main="main" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.17/require.js"></script>
</head>
<body>
<div class="draggie"></div>
</body>
</html>
 
I am testing an index.html file that works successfully inside a folder named 'require-js' which is inside the main folder named Main.
like so: Main/require-js/index.html. I've moved the 'require-js' folder from the Main folder into public_html/, and the index.html no longer succeeds,
so I played around with this path '../dist/draggabilly.pkgd' thinking that is the issue, but no success. Any help is appreciated.



HTML:
<!--<script src="/main.js" type="text/javascript"></script>-->
<script>
/* globals requirejs */
requirejs( [ '../dist/draggabilly.pkgd' ], function( Draggabilly ) {
new Draggabilly('.draggie');
} );
</script>
<script data-main="main" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.1.17/require.js"></script>
</head>
<body>
<div class="draggie"></div>
</body>
</html>
doing "../dist/" will attempt to reach the parent directory of 'dist', which will break the build if the file you are trying to reach is not there. IF you moved everything over to the public_html directory, you should just be able to do a relative path on there

[ '/dist/draggabilly.pkgd' ]

Note: This is assuming that your directory paths look like this:

/public_html/
index.html
/css/
/dist/
draggabilly.pkgd
 
Your path will be like - mywbsite(dot)com/require-js/index.html
using absolute paths will work.. provided you never move any files around or rename anything.. best practice is to use relative paths for all internal site pages, and only absolute paths if it is necessary or for external links
 

New Threads

Latest posts

Buy us a coffee!

Back
Top Bottom