thanpolas / grunt-closure-tools

Google Closure Tools for grunt
MIT License
95 stars 22 forks source link

#45 Fixed location of options with create_source_map #48

Closed fhurta closed 10 years ago

fhurta commented 10 years ago

Well, it's kindly embarrassing, but I must provide fix for my previous change. (I must have done undo or something just before previous commit..)

thanpolas commented 10 years ago

v0.8.6 released :+1:

nalbion commented 10 years ago

Could somebody please provide a working example of a project with working source maps? Please include directory structure and configuration of closureDepsWriter and closureBuilder.

I'm trying to build app/js-closure/**/*.js and bower-components/some-dep/**/*.js -> dist/js/demo.min.js and then run grunt connect from base: "dist/". I've finally got everything building, but now the browser is reading app/js/...* in the source map and trying to download (from dist)/js/app/js-closure/...*and/js/bower-components/some-dep/...`.

thanpolas commented 10 years ago

I can't really comment on the js-closure vs js issue, that is something that shouldn't happen...

On the fact that browser tries to download from (from dist)/js.... it is a common issue and I typically just create a symlink to the folder within the dist/ folder pointing back to the sources and everything works...

I know it's not an optimal solution but hey, it works =)

I'd like to hear if anyone has solved this in any other way...

sinelaw commented 10 years ago

We use a grunt task (grunt-text-replace) to search-replace and fix the relative paths in the source map file:

replace: {
    closure_source_map_paths: {
        src: 'dist/scripts/*.js.map',
        overwrite: true,
        replacements: [{
            // Replace paths like 'app\\shared\\bla.js' with '..\\shared\\bla.js'
            from: 'app\\\\',
            to: '..\\\\' // should be relative path to root from where the source map is located
        }]
    }
}
nalbion commented 10 years ago

Thanks @sinelaw

thanpolas commented 10 years ago

@sinelaw :+1:

nalbion commented 10 years ago

Closure Compiler v20140625 released!

https://groups.google.com/d/msg/closure-compiler-discuss/e-kTcluB40c/VDRGgP4CSZYJ