Is it possible to have middleman serve a file accessible at http://localhost:4567/css/main.css.map?

I have set up libsass as my scss preprocessor and it is capable of producing .map files. However, when I try accessing the resulting .map file, middleman produces an error.

The scss file name is main.scss. Processing this, libsass produces main.css and main.css.map

Accessing http://localhost:4567/css/main.css.map produces an error:

ExecJS::RuntimeError at /css/main.css.map
CssSyntaxError: <css input>:3:2: Unknown word "version": 3, "file": "main.css", ^ "sources": [

Ruby	c:/Ruby200/lib/ruby/gems/2.0.0/gems/execjs-2.3.0/lib/execjs/external_runtime.rb: in extract_result, line 65
Web	GET localhost/css/main.css.map

Renaming the file to main.css.map.erb does not change the error. Any ideas on how can I have middleman serve the file so that it is accessible at the http://localhost:4567/css/main.css.map URL?

I need to have the file at this URL for Chrome DevTools to automagically recognize it and connect it to the css file.

Hopefully you can workaround the problem with this in config.rb

ignore 'css/main.css.map'
after_build do
  `cp source/css/main.css.map build/css/main.css.map`
end

Thank you for responding! Ignoring the file results in the middleman server not finding it. Loading this url: http://localhost:4567/css/main.css.map brings up a page with the words Not found.

I am looking to be able to view the .css.map file during development, and having it updated in the browser by livereload, so creating a new build and viewing it without the middleman server is not really a good solution.

Which leads me back to the original question:

Is there a way to have middleman’s server serve main.css.map properly at http://localhost:4567/css/main.css.map ?

Sorry, I did not realize what kind of file this is.

The workaround will fix so that it is in the build, and therefore on the production site.

But naturally, you want this file to be on the development site, while tweaking the stylesheets.

Exactly. So, is this a possibility with Middleman? Is there a way to have it serve a static file as-is, without trying to interpret it?

The same way it serves plain .js files? The .map file is json so that’s pretty close.

Yes. See the workaround above.

ignore makes Middleman do nothing with the file.

The code in after_build copies the file to the build directory, so that it can be served.

(See also Is there a way to have build just pass files on as they are? )

Thank you for your time and for offering workarounds. I submitted this as a github issue and it was closed the same day.

Version 3.3.8 serves source map files properly (still does not produce them but now serves them if they were produced by another preprocessor).

Thank you, @tdreyno !