RiggerTheGeek RiggerTheGeek - 1 month ago 25
Javascript Question

How do I set Firefox Dev Tools to respect source maps in the console?

I'm using Firefox v47 on a Mac. I've worked out how to get the Debugger to use JavaScript source maps to show where I'm triggering some code, but it uses the compiled file in the Console. How do I get it to show me the uncompiled file lines?

This works out of the box in Chrome, so seems an odd omission in Firefox so I'm assuming I've done something wrong.


In the Firefox Toolbox Settings, enable the option Show original sources in the Style Editor area. This option should, however, be enabled by default in all Firefox versions >= 35 (source)

There is a seperate article about source map support in Firefox that elaborates on the minimum required Firefox version for sourcemaps to work (Firefox 29).

Also, keep in mind that not all SASS-generated files come with sourcemaps - this is a feature that must be manually enabled with the --sourcemap argument if you're using it from the command line, by rendering it with render_with_sourcemap from within a ruby program, or by other means if you're using a task manager such as gulp or grunt.
You can check if your stylesheet has an associated sourcemap by looking at the last non-empty line of your generated css file - it should look somewhat like this:

/*# sourceMappingURL=style.css.map */