I'm currently trying to migrate an old ASP.NET WebSite project to Visual Studio 2015. I'd like to use NPM/Gulp to automatically compile LESS files to CSS (this task was done by WebEssentials in VS 2013).
I added a package.json
file to the project to load the required components. This creates a node_modules
folder in the root of the WebSite project, and this is where my problem starts:
Since WebSite projects don't have a project file, all files (and sub-directories) found in the project root folder, are automatically part of the project. Due to the deeply nested directory structure inside node_modules
, this leads to errors because of too long path names.
An easy workaround is to set the hidden
attribute on the node_modules
folder (but this has to be done manually by each developer).
Is there a way to tell NPM to put the node modules into another directory e.g. one level above the project (..\node_modules
) where the solution file is?
Or is it possible to set the hidden attribute on a folder from a gulp-task (which runs when the project is loaded)?
Based on @Rik's answer, I was able to solve the problem:
Instead of adding the package.json
and gulpfile.js
into the WebSite project, I added them at the solution level (as solution items). This means, that the node_modules
folder is now in the solution directory at the same level as the WebSite project(s).
The only other change was to modify the paths in gulpfile.js
accordingly.