grunt-usemin
grunt-usemin copied to clipboard
If a html file has Windows line feeds, usemin will silently not replace the blocks
Converting the file to have Unix line feeds allows usemin to succeed.
Try using the patch in #604 or changing the package.json to refer to https://github.com/lu4/grunt-usemin
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:
- create a simple html file with two build tags after each other
- use the default setup for usemin
- checkout the code with your Windows machine where git's config is set to core.autocrlf is set to true
- run the build and notice, that the second <!-- build:js ... > tag is still there and not replaced.
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']
}
}
}