I have a few images, fonts, some css and js files, a big node_modules folder and a index.html file. I want to create a dist folder which copies everything as it is but without the node_modules folder. I don’t want to compress them so there’s no point of using a gulp minification plugin. Is there any build tool to do so?
Gulp can be used to copy files from one place to another.
Something like this should work (untested):
gulp.task('copyfiles', () => {
gulp.src(['./*', '!dist', '!node_modules'])
.pipe(gulp.dest('./dist'));
});
This still copies the node_modules folder
You’ll have to experiment with what you are passing to src
, but you can definitely exclude files / directories using an exclamation mark.
If you post your existing directory structure and your desired one (after the task has run) I don’t mind taking a look.
Wouldn’t it be simplest to just have your source files in a dedicated src
folder, so that you don’t have to worry about node_modules
and other stuff in your app’s root directory in the first place? I mean you certainly don’t want to copy your gulpfile.js
, .gitignore
etc. to the dist
folder either…
This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.