Skip to content

Concatenating files that end in comments adds the first line of new files as comments too #184

@hdwebpros

Description

@hdwebpros

npm install bootstrap
Then setup your Gruntfile with these options:

concat: {
        options: { 
          separator: ';'
        },
        modal: {
          src: ["node_modules/bootstrap/js/dist/util.js","node_modules/bootstrap/js/dist/modal.js"],
          dest: "js/modal.js"
        }
     },

Now open your modal.js file.

Look at line 139. It reads
//# sourceMappingURL=util.js.map;function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }

And the function _extends() gets put in with that comment.

If you edit the util.js file and add an extra line after it, the file concatenates properly, saving that function.

I'm not sure if the true fix is to force a new line after every file that ends in a comment, or fix concatenate to detect if this is true and add that new line afterwards.

Metadata

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