LibraryManager icon indicating copy to clipboard operation
LibraryManager copied to clipboard

Library Default Destination

Open tb-mtg opened this issue 7 years ago • 1 comments

Instead of specifying the destination of each library, is it possible to introduce a new "default destination" setting that uses conventions at the top level of libman.json. This setting would still be able to be overwritten at each library level.

For example:

  • twitter-bootstrap version 3.3.7 library would go to wwwroot/lib/bootstrap
  • jquery version 1.12.0 library would go to wwwroot/lib/jquery/1.12.0
  • jquery version 3.3.1 library would go to wwwroot/lib/jquery/3.3.1

the libman.json would look something like this:

{
  "version": "1.0",
  "defaultProvider": "cdnjs",
  "defaultDestination": "wwwroot/lib/[LibraryName]/[Version]",
  "libraries": [
    {
      "library": "[email protected]",
      "destination": "wwwroot/lib/bootstrap"
    },
    {
      "library": "[email protected]"
    },
    {
      "library": "[email protected]"
    }
  ]
}

Thanks

tb-mtg avatar Apr 19 '18 23:04 tb-mtg

You likely wouldn't want to introduce version number into your file names/path as each update would break all of your references unless you're using wildcard/masks, but that's up to the each person who comes up with the their own default path. But it would be nice to expose a way to inject certain pieces of information from the library into the path using tags in the defaultDestination. [Name] and [Version] would be easy as both are properties hanging off of the ILibrary interface. Probably a good idea to sanitize the name/version before use though, just in case there are characters that are invalid for a path.

nickalbrecht avatar Apr 19 '18 23:04 nickalbrecht