Skip to content

Allow to customize the “sources” field in the sourcemaps. #283

Open
@stanch

Description

Currently the sources field in sourcemaps is always relative to the sources. In my case it looks somewhat ugly:

../../../../src/main/webapp/home/scripts/home.js

I’m including the sources with sourcesContent and not serving the actual sources (and if I were serving them, it wouldn’t be at that path...).

Is there an option to tweak that relative path? uglify.js mentions -p/--prefix, but as far as I can see it’s not available from this plugin. I also tried sourceMapRoot, but it did nothing.

My base setup is like this:

uglify: {
  options: {
    sourceMap: true,
    sourceMapIncludeSources: true,
    compress: true,
    mangle: true
  },
  build: {
    files: [{
      /* Minify all but vendor scripts */
      expand: true,
      cwd: 'src/main/webapp/home',
      src: ['scripts/**/*.js', '!scripts/vendor/**'],
      dest: 'target/grunt/home'
    }]
  }
}

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions