generator-jekyllrb icon indicating copy to clipboard operation
generator-jekyllrb copied to clipboard

Inaccessible file path in *.css.map

Open wiredmind opened this issue 10 years ago • 4 comments

SASS Source map file, e.g., main.css.map, refers the source path as: "../../app/_scss/main.scss", however this file path isn't accessible by the browser. From the browsers point of view main.scss lives under /_scss/. Adjusting Gruntfile to include '.' in connect.livereload.options.base eradicates the problem:

connect: {
  options: {
    port: 9000,
    livereload: 35729,
    // change this to '0.0.0.0' to access the server from outside
    hostname: 'localhost'
  },
  livereload: {
    options: {
      open: true,
      base: [
        '.tmp',
        '.jekyll',
        // add this to fix 404 in sass source maps
        '.',
        '<%= yeoman.app %>'
      ]
    }
  }
}

wiredmind avatar Mar 12 '14 03:03 wiredmind

I haven't played around with sourcemaps yet. I'd prefer to generate sourcemaps into tmp and not reference anything outside of the tmp/app/dist folders when you're in the browser. If you can get that to work PRs gratefully accepted.

robwierzbowski avatar Mar 20 '14 19:03 robwierzbowski

The issue doesn't lie with the path to the source map (.css.map), but with the path to the source itself (.scss). The source map file is currently properly generated and served out of .tmp directory, but the browser must be allowed access to the source file if browser editing of source files is to work. To serve the source file out of .tmp would complicate and increase the time needed to run grunt tasks.

wiredmind avatar May 13 '14 04:05 wiredmind

Yeah, this is a tricky problem. The solution would be the same for any Yeoman generator — is there a generator that currently has sourcemaps working?

robwierzbowski avatar May 23 '14 21:05 robwierzbowski

what @wiredmind suggested works very well. The fact is that, if you need SOURCEmapping, then the name says all, you have to give access to the source!

mohamnag avatar Feb 19 '15 12:02 mohamnag