Home > Net >  What to use in Gulp to make a path into node_modules
What to use in Gulp to make a path into node_modules

Time:12-22

I have a project that uses gulp and I need to use splide js to create a slider, i used NPM to install splidejs and now I need to include splidejs CSS file to my main.scss however whatevere I do to get to node_modules file from my main.scss is not working. In webpack we use ~to get to node_modules but how can i do it in gulp to get there?

I have tried with ~ and with node_modules path and directory in project but nothing works

CodePudding user response:

In Gulp, you can use the gulp.src() function to specify a file path that includes the node_modules directory. This function allows you to specify the source files that you want to include in your Gulp task.

For example, if you want to include all the JavaScript files in the node_modules directory in a Gulp task, you could use the following code:

gulp.src('node_modules/**/*.js')

.pipe(someGulpPlugin())

.pipe(gulp.dest('dist'));

This will include all the JavaScript files in the node_modules directory and its subdirectories in the Gulp task. The ** wildcard indicates that all subdirectories should be included, and the *.js pattern indicates that only JavaScript files should be included.

You can also use other file globs or patterns to specify the specific files that you want to include in your Gulp task. For more information on using file globs with Gulp, you can refer to the Gulp documentation.

  • Related