Search code examples
asp.net-corejspm

Where should jspm_packages go in ASP.NET CORE?


I'm developing with ASP.NET Core, and am using jspm, with Visual Studio 2017 RC and WebStorm.

It seems that jspm init expects your absolute lowest level, root folder with EVERYTHING is always going to be wwwroot, and thus the path it establishes (and even more rigidly enforces in jspm 0.17.x beta) iswwwroot/jspm_packages`

However, a new ASP.NET Core project sets up with the node_modules directory, and by proxy the packages.json file, just outside of wwwroot.

Obviously, I can move the file - but it puzzles me that they're different. Some people say "just use a gulp task" but that isn't really an option. I tried that route and it was a complete nightmare to maintain. Plus, jspm seems to load things directly from its package store by default.

So which is it? Is there an inherit problem with the jspm_packages folder being a sibling to the wwwroot folder? Using the UseStaticFiles option in the configuration allows me to specify access to folders outside of wwwroot.


Solution

  • wwwroot is your public folder, this way, all your assets must be inside of it.

    You can configure npm to install modules inside wwwroot folder. Take a look in this config page from npm documentation.

    However, I recommend you to put your files outside the wwwroot folder, and then, send to wwwroot only the files you're gonna use.

    Grunt and Gulp are very simple and useful. If you want to give it a try, take a look in this tutorial. There you can find an example of how to use Grunt with VisualStudio