Base solution for your next web application
Starts in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

Adding javascript libraries #462


User avatar
0
doubledp created

Could anyone provide some guidance on the best way to add a javascript library such as amCharts. Is this a manual process or do you do this through NuGet?

The steps to get this to work would seem to be: Download library, manually add script and css files to solution/Install library through NuGet Include script in ScriptPaths under App_Start/Bundling Include css in StylePaths under App_Start/Bundling Include dependency in app.js

Ideally I would like to be able to auto update these libraries when added, can you please direct me in applying best practice and how to achieve that?


4 Answer(s)
  • User Avatar
    0
    hikalkan created
    Support Team

    Hi,

    I suggest to use Nuget wherever possible. I did not used Nuget for all libraries for some reasons:

    • Some nuget packages are not updated regularly.
    • Nuget packages restores scripts/css files into seperate directories. I prefer all files of a library should be in a single root directory.
    • Metronic may not work properly with latest version of some libraries (In most case there be will no problem, but should test it).

    But as I said, for application specific libraries, use Nuget wherever possible. And yes, your steps are true. Note that: there are 3 seperated bundles for angular, mvc and frontend projects. If you're using mvc, you can add libraries per page and add only commons to bundle.

  • User Avatar
    0
    doubledp created

    Thank you Halil :D

    I using the Angular version. I wonder if it possible to control the updating of the javascript libraries through npm?

    What is your thoughts regarding this?

  • User Avatar
    0
    hikalkan created
    Support Team

    Bower is used generally for front-end javascript libraries. Visual Studio 2013 does not works well with Bower but VS 2015 and ASP.NET 5 are integrated to Bower. Since ASP.NET 5 currently in beta and we want to support VS2013, we don't use bower.

    BTW, Angular is added with nuget and it can be updated easily.

  • User Avatar
    0
    doubledp created

    Ah ok, I understand. I am currently using VS2015 and I will try to implement something like in my own project.

    Thank you for the insight