Having restore options, both manual and automatic In order to get the library files to restore there are two choices, either restore them manually whenever you need them, or enable restoring them on build - all of which are available as options when right-clicking on the libman.json file that LibMan adds to your project. Et voila, all the libraries get restored, except. Just to prove that it does, really work, delete the jQuery and Bootstrap folders and then re-build the project. When it's done all the selected files should've appeared in Solution Explorer ready to be used, ready to use LibMan again to add jQuery - somewhat important as Bootstrap won't do anything without it! Now there's something of substance to add to index.html, so here it is in all its glory: Īll this does is uses Bootstrap to show a button that when pressed shows a dialog box which is just enough to prove that the library files are where they should be and all working properly: Once you've finished selecting files and click 'Install', the bottom bar of Visual Studio will show this for a while: There's definite opportunity for an enhancement to LibMan here as trying to do this long-hand by adding multiple references to packages and filtering the files into different target folders causes an error related to having muiltiple instances of the same library. What would be nice is if I could map each of the files/folders I've chosen into my project in differing locations, as it stands I've got all the JavaScript, CSS and fonts for Bootstrap sat under folders. Now I can pick and choose just the files that I want as I'm not interested in quite a few files in the package: In order to install Bootstrap (3.x.x) I'm going to use the "unpkg" provider and search for the specific version " ". Target Location - where you want them to go you decide, not the package manager.Include all library files / Choose specific files - Do you want every file for the library, or just some of them? You get to choose!.Library - as the watermark says, type to search to find the library you want.Provider - this is where you choose between cdnjs, filesystem or unpkg. Once the LibMan window's open, which you can see right at the top of this post so I won't repeat it here, there's four key things to do/decide: Bootstrap! Using LibManīefore starting off with LibMan, I've added a new bootstrap folder to my to open the LibMan window: Next up is actually using LibMan to drop in a client JavaScript library, and for this I'm going to choose. Once that was done I added a simple index.html to call so that requests get processed in the right order! Just to summarise, Startup looks like this: public void Configure(IApplicationBuilder app, IHostingEnvironment env) Next up was making sure that static content (HTML, JavaScript, CSS and all that jazz) would be served by adding app.UseStaticFiles() to my Startup class. It works either by looking at the CDNJS distribution network, or a local (or network!) file-system store you've specified, so if you want to make sure your development teams environment will function in the absence of either internet access or the availability of CDNJS then there are options there for you.Īctually using it is really simple, to demonstrate it I've created a new ASP.NET Core Web Application project (2.1, of course!) choosing the just give me an empty project and I'll go from there option to keep it really really simple. LibMan seems to be focused on client-side library and CSS management rather than being an "all the things" delivery method like NuGet, it doesn't require any additional tooling (so no npm along with its Node.js dependencies) and it lets you be explicit about where you want files to end up in your project, rather than having to add build tasks to hustle files around from where the package manager puts them to where you want them. What's LibMan, why's it different and how does it work? There's a lot of different library/package managers out there, of course there's NuGet, NPM, Bower and Yarn to name some of the better known ones - and I'm sure I'll have missed a few from the "better known" list even then. The latest release of Visual Studio 2017 (15.8) comes with Microsoft Library Manager, or LibMan for short, there's also a CLI available and if you want to read about it from the horses mouth there's a post on the ASP.NET Blog all about it.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |