In these files, the browser compiles and loads the coffee-script code, with a module system provided by the bootloader in main.js
.
The source maps in this gist are not working. They are giving me line after the source of the logging in Chrome 33. In firefox 27, it doesn't seem to work at all.
I would like you to solve a problem for me: Figure out how to get the source maps working in this setting. Provide an option for embedding the source along the source map and the code. Provide way to specify a source URL, to make it easier to locate the module.
As a reward, you are making client-side browser development bit less intimidating.
- Git clone this gist
- Reach your
coffee-script.js
:
mkdir lib
pushd lib
wget http://coffeescript.org/extras/coffee-script.js
popd
- Compile the main.coffee
coffee -c main.coffee
- Start up some temporary server
python -m SimpleHTTPServer
- Browse to the page and check the source maps in the inspector to see what is output.
- Solve the problem!
PS. The module loader needs to be customizable. One solution never fits everybody.
PS. PS. The eval
doesn't work here. It penalizes in performance.