Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Usemin replace task incorrectly matches filename when files in subfolders have the same name #565

Closed
trabus opened this Issue · 5 comments

3 participants

Jake Bixby hemanth.hm Frederick Ros
Jake Bixby

When running the build command, when there are two files with the same name (in different folders) the usemin:html replace task fails when matching the filename of the minified file to retrieve the version number.

To replicate, init a quickstart project, create an images folder in the app folder. Then place two image files with the same filename in the images folder (one in a subfolder).

/images/test.jpg
/images/subfolder/test.jpg

Use both of the images somewhere in the index.html so the filenames will get re-written by the usemin task.

// somewhere inside index.html
<img src="images/test.jpg">
<img src="images/subfolder/test.jpg">

Run the build command, and you'll notice that the usemin replace task uses the version identifier of the first file it processed.
Excerpt from build log-

usemin:html - index.html
>> images/test.jpg
was <img src="images/test.jpg"
now <img src="images/156424e4.test.jpg"
>> images/subfolder/test.jpg
was <img src="images/subfolder/test.jpg"
now <img src="images/subfolder/156424e4.test.jpg"

After some investigation (dropping console.logs into the usemin replace task), it seems the regular expression is catching the first instance of the filename and using that, discounting the path entirely.

hemanth.hm
Owner

@sleeper Need your help here!

Frederick Ros
Owner

I'll have a look at it tonight or tomorrow morning first thing.

Frederick Ros sleeper referenced this issue from a commit in sleeper/yeoman
Frederick Ros sleeper Fix issue #560 and #565
Treat the case of empty lines in blocks (#560)
as well as the filename collision (#565)
e41faba
Frederick Ros
Owner

Fixed in the above PR.

Frederick Ros sleeper referenced this issue
Merged

Fix issue #560 #563

Frederick Ros sleeper referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
Frederick Ros sleeper referenced this issue from a commit in sleeper/yeoman
Frederick Ros sleeper Fix issue #560 and #565
Treat the case of empty lines in blocks (#560)
as well as the filename collision (#565)
45c9d02
Jake Bixby

@sleeper Awesome, thanks!

Frederick Ros sleeper closed this
Márton Szinovszki szinya referenced this issue from a commit in menthainternet/yeoman
Frederick Ros sleeper Fix issue #560 and #565
Treat the case of empty lines in blocks (#560)
as well as the filename collision (#565)
bdc24e4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.