• If you create a snippet as a “Library scoped to footer” initially, and then go back and edit the code and switch the scope to “External library scoped to footer,” the original file created still remains. This is probably okay as the user might change it back and the file will be there for them to modify later, but might be a concern if the user ends up creating a bunch of snippets by mistake, creating lots of random files.
    • Is it possible to remove the JS file when switching the scope option, or should this remain as-is?
  • When you delete a snippet, the snippet is removed from the list, but the file remains in the file system as well.
    • Is it possible to remove the JS file upon snippet deletion?

Comments

Song created an issue. See original summary.

Song’s picture

Title: Delete JS file after removing snippet » Delete JS file after changing scope or removing snippet from list
Issue summary: View changes
Song’s picture

Issue summary: View changes

  • jerdavis committed d3e127a on 8.x-1.x
    Issue #2993455 by song, jerdavis: Delete JS file after changing scope or...

jerdavis credited song.

jerdavis’s picture

Status: Active » Fixed

Changed method for selecting external to being a test against the content of the snippet. The snippet is passed through PHP's filter_var and validated as a URL. If a URL is detected it's determined to be an external library, otherwise a file is generated and saved. If a snippet has a saved file but then gets switched to an external resource the saved file is deleted. If a snippet is deleted, the saved file is also deleted.

Song’s picture

Status: Fixed » Active

When I delete the snippets, they are now removed from the file system, but under Files, they still appear in the list. Can they also be cleaned up from that list? Thanks!

jerdavis’s picture

Assigned: Unassigned » jerdavis
Status: Active » Fixed

  • jerdavis committed dd19145 on 8.x-1.x
    Issue #2993455 by song, jerdavis: Delete JS file after changing scope or...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.