grunt-usemin icon indicating copy to clipboard operation
grunt-usemin copied to clipboard

If a html file has Windows line feeds, usemin will silently not replace the blocks

Open needcaffeine opened this issue 9 years ago • 3 comments

Converting the file to have Unix line feeds allows usemin to succeed.

needcaffeine avatar Feb 25 '16 06:02 needcaffeine

Try using the patch in #604 or changing the package.json to refer to https://github.com/lu4/grunt-usemin

ThomasHambach avatar Mar 04 '16 06:03 ThomasHambach

This is indeed a problem if you yourself are working on a Mac or Unix system and your colleagues or the build system is running on Windows and you're using GIT. Depending on the GIT flag core.autocrlf the line endings are automatically converted (core.autocrlf = true as recommended for Windows).

Steps to reproduce:

  1. create a simple html file with two build tags after each other
  2. use the default setup for usemin
  3. checkout the code with your Windows machine where git's config is set to core.autocrlf is set to true
  4. run the build and notice, that the second <!-- build:js ... > tag is still there and not replaced.

BouncingBit avatar Sep 02 '16 06:09 BouncingBit

In case it helps, here it is another workaround. We ended up using grunt-lineending before usemin so it replaces all Windows line feeds.

lineending: {
  dist: {
    options: {
      overwrite: true
    },
    files: {
      '': ['<%= dist %>/index.html']
    }
  }
}

fbarbat avatar Apr 26 '17 20:04 fbarbat