JavaScript debugging with middlemanapp

Hi,

I am using WebStorm and RubyMine to develop static sites using middlemanapp (http://middlemanapp.com). The document that is served up has a single JavaScript include (script.js). I can map script.js to the local script.js file. This works fine.

The problem is that with globbing/sprockets, all other JS files are merged into script.js when it is served up. And so for each file on my local file system, there is not a file on the server to map it to. How would one go about debugging JavaScript in this kind of scenario?
The same problem would occur if I had Grunt/Gulp concatenating all files into one JS file and only including that one file on the page. I'd prefer not to have to refactor the way I am including JS files for the sake of being able to debug them in RubyMine/WebStorm.

Am I missing something?

3 comments
Comment actions Permalink

Hi, I will check it and give you detailed answer.

>> Am I missing something?
In general, we are trying to guess and you don't have to confgure it. I will check what's wrong. (Please note — since Chrome 43 there is a problem, see https://youtrack.jetbrains.com/issue/WEB-16829).

0
Comment actions Permalink

Could you please attach test project?

0
Comment actions Permalink

Thanks for your reply Vladimir.

I also raised a support ticket and go the following reply (from Elena Pogorelova):

"JavaScript debugger uses sourcemaps in order to map the source files to the ones that are actually executed. Normally you don't need to do anything special to debug using sourcemaps - just create breakpoints in your original files and run your code in debugger... But your map files have to conform to Source Map Spec (https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?hl=en_US), and the generated js file should have the properly formatted //@ sourceMappingURL comment.
As far as I can see, middleman doesn't yet support sourcemaps for concatenated javascript (https://github.com/middleman/middleman-sprockets/issues/44). Gulp/Grunt do support them (sourcemaps generated by these tools are not always correct, some tuning may be needed, but they work)"

I believe that answers my question. I guess I'll have to stick it out until Sprockets 4.0.0 is released : /

0

Please sign in to leave a comment.