GithubHelp home page GithubHelp logo

grunt-concat-sourcemap's People

Contributors

davemo avatar dobogo avatar joliss avatar kozy4324 avatar maks3w avatar michaek avatar mrcljx avatar shinnn avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

grunt-concat-sourcemap's Issues

Incorrect configuration examples in Readme.md

The configuration examples shows:

    files: {
      'dest/default_options.js': ['src/a.js', 'src/b.js']
    }

as the syntax for specifying the source and destination files when it should be:

    'dest/default_options.js': ['src/a.js', 'src/b.js']

At least that's what I had to use in order to get things working.

Publish stable tag

Since the last release many changes has been added. I think is good to make a new release tag.

Sources path not set correctly for Windows (0.4.3)

The paths for source map files aren't proceeded correctly on windows.
They include backslashes instead of slashes, and the maps aren't working.

I use this:

concat_sourcemap: {
    target: {
        files: {
            'path/output.js': ['another-path/**/*.js']
        }
    }
}

After running grunt i get an output like this:

{
    "version": 3,
    "file": "output.js",
    "sources": [
        "src\\file.coffee"
    ],
    "names": [],
    "mappings": "..."
}

Process embedded source maps

I'm trying to use a grunt-concat-sourcemap task after a grunt-browserify task but I'm getting a warning as grunt-concat-sourcemap is trying to use the encoded string as a filename to open.

Browserify embeds the source map as a base64 encoded string, i.e: data:application/json;base64.

Could this plugin detect the embedded source map, decode it and use it directly?

Add sourceMap: false option

This may be beyond the scope of what you're doing but I thought I'd propose it anyway: add an option for sourceMap: false that allows you to concatenate without generating a sourcemap.

I recognize this can be done simply by using grunt-contrib-concat but it seems a little silly to have two plugins, especially since I'm concatenating / minifiying locally expressly for the purpose of mirroring production as closely as possible and thus it would be great to be using the same plugin too.

Happy to help implement; I just wanted to make sure that was interesting to you.

Input source map?

Uglify has an option for --in-source-map to generate a source map based on JavaScript that's already compiled from somewhere else. Is there a reason to support that feature in grunt-concat-sourcemap? (Or does it already exist, and I've overlooked it?)

Travis CI setting

Test! Test! Test!

It is necessary to configure automation test with multiple Node environments.

Change sourceMappingURL

Since my sourcemap must be relative to the web root, I want to manually set my sourceMappingURL (ie /# sourceMappingURL=scripts.js.map). sourceRoot doesn't seem to do this.

Use with input sourcemap has null sourcesContent

In this example, I have two grunt tasks. The first, compiles Sass files to CSS, generating sourcemaps. The second concatenates the generated CSS files with grunt-concat-sourcemap. My output sourcemap is the following:

{
  "version": 3,
  "file": "app.css",
  "sources": [
    "app/stylesheets/one.scss",
    ".tmp/stylesheets/one.css",
    "app/stylesheets/two.scss",
    ".tmp/stylesheets/two.css"
  ],
  "names": [],
  "mappings": "AAAA;ACCA,K;ACDA;ACCA,K",
  "sourcesContent": [
    null,
    ".one{font-weight:bold;}.uno{font-style:italic;}\n/*# sourceMappingURL=one.css.map */",
    null,
    ".two{font-weight:bold;}.dos{font-style:italic;}\n/*# sourceMappingURL=two.css.map */"
  ]
}

Most obviously, the sourcesContent for the *.scss source files is null. But it seems that there's no reason (in this case) for the *.css source files and their sourcesContent to be included in the sourcemap.

I understand that this doesn't represent all cases - in some cases there may be a necessity to merge the input sourcemap with "original" source mappings from a single file, though it's hard for me to imagine this in practice. That said, I'm curious if there may be a way to exclude the *.css sources if there's nothing to merge.

Source maps not read correctly when source file path contains spaces

When my source code is in a path with spaces, e.g. "Source Code", this task fails with the following output:

Running "concat_sourcemap:scripts" (concat_sourcemap) task
[D] Task source: /.../node_modules/grunt-concat-sourcemap/tasks/concat_sourcemap.js
Warning: Unable to read "Source%20Code/app.litcoffee" file (Error code: ENOENT). Use --force to continue.

concat_sourcemap options:

{
    sourcesContent: true
}

wrong CSS sourceMappURL line

I may just be missing a configuration line, but from the code it looks like on line 79 the output is always:

sourceNode.add('//@ sourceMappingURL=' + mapfilepath);

This does not work for CSS files. It instead should output:
/*# sourceMappingURL=master.css.map */

Which works in Chrome.

Is it feasible to add support for `sourcesContent`?

I was reading the mozilla documentation and came across sourcesContent: Optional. An array of contents of the original source files.

Would it be feasible to add an option to grunt-concat-sourcemap so that sourcemaps could be entirely self contained, including the mappings and the original sources? The reason I think this would be useful is that it would simplify server-side configuration and avoid having to upload original src files along with the map; unless I'm misunderstanding the purpose of soucesContent

Thoughts?

path shortening

Background: I currently run my grunt build at the full app (server+client) root, so that i can have Maven (via frontend-maven-plugin) run the grunt build on the CI server and thereby avoid checking grunt build artifacts into git.

The result, given our server setup, is that all css and js live (and are built) under a 'src/main/resources/static' directory/path. This directory is not part of the deployed path, but nonetheless ends up in the sourcemap file paths, thereby making the browser unable to find the source files listed in the map. To say it another way, the css ends up correctly at 'http://server/css/result.css', the map ends up correctly at 'http://server/css/result.css.map', but the sources are listed in the map as 'src/main/resources/static/css/source.css' instead of just 'source.css'.

I need an option to truncate the 'src/main/resources/static/css' off of the file paths. Any ideas?

Including "./" in sourceRoot causes weird path concatenation in Windows

Target config:

concat_sourcemap: {
    main: {
        files: {
            './build/build.js': filesToBuild
        },
        options: {
            sourceRoot: './build/tmp/lib',
            sourcesContent: true
        }
    }
},

Error message:

Warning: "build/tmp/lib/ d:/path-to-project/build/tmp/lib/somefile.js" is not in the SourceMap. Use --force to continue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.