trunk icon indicating copy to clipboard operation
trunk copied to clipboard

267 Rename ```copy-file``` assets

Open zottwickel opened this issue 2 years ago • 4 comments

Hi all!

This is my first PR for this project, so if anything is out of line with the code I wrote, feel free to call it out. I appreciate constructive criticism.

Overview

Resolves #267

Users have requested that they have the ability to change the file name when using Trunk to copy a file. This pull request is to reassign the file name-related attributes to the single FileAsset before it is written to the new directory.

Checklist

  • [X] Updated CHANGELOG.md describing pertinent changes.
  • [X] Updated README.md with pertinent info (may not always apply).
  • [X] Updated site content with pertinent info (may not always apply).
  • [X] Squash down commits to one or two logical commits which clearly describe the work you've done. If you don't, then Dodd will 🤓.

Manual Testing Steps

  • Create a project or use a previously existing project that has a <link data-trunk rel="copy-file" ... /> tag in its index.html file.
  • Add the new-name attribute to it with any value you see fit (although you may run into more errors down the line if unsupported characters or file types are used).
    • ex: <link data-trunk rel="copy-file" href="assets/favicon.ico" new-name="bojangles.jpg" />
  • Run trunk serve or any other build command.
  • Check the dist/ directory (or other compilation target directory, should it differ in your environment) for your copied file with a new name.

zottwickel avatar Nov 03 '21 04:11 zottwickel

My two (admittedly bikeshedding) cents: I think trying to stay HTML5 compliant as possible would probably be the most intuitive. data-dest might be a better name; or we could also (ab)use and use overload target instead as the attribute name.

edward-shen avatar Nov 05 '21 07:11 edward-shen

@edward-shen I like where your head is about this. I've read some attribute-related issues for this project about the usage of the data- prefix for HTML attributes, and there are discussions about changing it to a trunk- prefix in the future. I happen to be on team trunk-, but since that change hasn't happened yet, I'm of a mind to go with data-dist for this issue. That way if and when HTML attributes are revisited project-wide, this one won't sneak past anyone.

zottwickel avatar Nov 06 '21 02:11 zottwickel

This is a great feature. Any plans to get this PR merged?

NiklasEi avatar Mar 24 '22 21:03 NiklasEi

@NiklasEi definitely! If you would like to push a changeset on top of this branch to fix these items, that would be awesome. Just don't overwrite @zottwickel's work 😄

thedodd avatar Jun 30 '22 03:06 thedodd

This PR is stale because it has been open 45 days with no activity. Remove stale label or comment or this will be closed in 10 days.

github-actions[bot] avatar Oct 31 '23 00:10 github-actions[bot]

This PR was closed because it has been stalled for 10 days with no activity.

github-actions[bot] avatar Nov 11 '23 00:11 github-actions[bot]