Skip to content

Instantly share code, notes, and snippets.

@tecfu
Last active August 29, 2015 14:06
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tecfu/f84a65ffa850a0bc2e88 to your computer and use it in GitHub Desktop.
Save tecfu/f84a65ffa850a0bc2e88 to your computer and use it in GitHub Desktop.
Solving the file name with multiple dots problem in Grunt:

Solving the file name with multiple dots problem in Grunt:

Use the extDot property instead of the ext property.

In Grunt, this is how your can match filenames with multiple dots and write to filenames that contain the original dot sequence, except for file extension.

/path/to/module.somename.scss -> /path/to/module.somename.css

Example:

files: [{
  expand: true,
  src: ['public_html/**/*.scss'],
  extDot: 'first',
  rename  : function (dest, src) {

    var _new_ext = 'css';

    //Get src filename
    src = src.split("/");
    var filename = src.pop();

    //Apply new extension to filename
    var arr  = filename.split(".");
    arr.pop();
    arr.push(_new_ext);
    filename = arr.join(".");

    dest = dest || src.join("/");

    return dest + '/' + filename;
  }
}]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment