I started learning JS and at the moment I am working on Require.js. Here is the deal, I have simple html page and js in it:
<script data-main="js/main.js" src= "js/lib/require.js" type="text/javascript"></script>
I do really have main.js in the root/js folder but by some reason page is looking for main.js in the root. Error:
*Failed to load resource file:///work/programs/brackets/4proj/main.js*
If I put main.js in the root (data-main="main") all will work as expected but I don't want to have a lot of *js in the root, even 2 js files. I saw in the require.js examples that it is possible but I have had no success with it.
What I've tried:
/js/main.js
./js/main.js
//js/main.js
and all the same without extension. It's still not working.
Here is project structure. Project folder - 4prog/
- /js
- /js/lib/ <- jquery.js,require.js
- /css
- index.html
p.s. I am using Ubuntu + brackets + chromium.
.js
fromdata-main
? – Qantas 94 Heavyfile:
URIs causes a huge pile of gotchas when dealing with dynamically loading anything. It really isn't worth doing development in an environment without a webserver. – Quentinfile:
to test ideas (and to answer SO questions): none of them required a server to run properly. – Louis