Change path node_modules in one function

0

Is it possible to change the path of the nodule_modules within a function?

I have a structure in gulpfile.js in which there are different scripts for different tasks: minify, join, optimize, etc.

But there is also a function in which I make a version of the web, in which different portals come out, in which only the CSS changes.

The thing is that now I have to copy the folder node modules in each of the subdirectories and I would like to be able to change its route so that I do not have to do this step that makes me waste a lot of time.

The structure is:

/CarpetaRaiz
    /src
    /dist
    /node_modules
    /Versiones
       /VersionWeb1
          /src (con sus CSS)
          /dist
       /VersionWeb2
          /src (con sus CSS)
          /dist
       /VersionWeb3
          /src (con sus CSS)
          /dist
       /VersionWeb4
          /src (con sus CSS)
          /dist

And here comes the problem, since I have to copy the node_modules folder to VersionWebX, there are now 16 versions, imagine the time that is lost by copying that folder 16 times.

Is there a way to optimize the script, taking the path to the original node modules in the "versions" function?

Edit 1

Working on a Windows computer

    
asked by Diego 30.08.2017 в 08:27
source

1 answer

1

If the server is Linux, you can create a symlink instead of copying the entire folder:

(desde CarpetaRaiz)

ln -s ./node_modules ./VersionWeb1/node_modules

To learn more about symlinks in Linux

If the server is Windows, this would be the command:

mklink /D ./VersionWeb1/node_modules ./node_modules

To learn more about symlinks in windows

    
answered by 30.08.2017 / 09:40
source