question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Gulp not copying files with simple task

See original GitHub issue

I am trying to copy an HTML page from my ‘src’ folder to my ‘dist’ folder but it’s not working and I can figure out why. I’ve tried looking online and all the snippets of code I found are doing exactly the same, except it’s not copying anything in my case.

my project’s folder structure:

  Test
   |
   |-- dist
   |-- node_modules
   |-- src
       |-- index.html

My Gulpfile

'use strict'

var gulp = require('gulp');

gulp.task('copy', function () {
    return gulp.src('./src/index.html')
        .pipe(gulp.dest('./dist/'));
});

I’ve tried removing the “return” , trying using glob (./src/**/.html, src/.html), I’ve tried using base: ‘src’ and ‘test’… Nothing works and it’s driving me nuts. Any ideas?

Npm and Gulp versions

npm: 5.6.0
gulp: 3.9.1

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
ashishpatel1992commented, Feb 21, 2018

I was running node gulpfile.js instead of gulp Newbie to gulp 😄

0reactions
phatedcommented, May 13, 2018

Closing due to inactivity.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Gulp doesn't copy all files as expected - Stack Overflow
SOLVED IT MYSELF! The problem was caused by async operating tasks. Adding a return forced gulp to complete the copying process before continuing!...
Read more >
Copying files with Gulp doesn't work - JavaScript - SitePoint
In my Gulp file that I'm using to customize Bootstrap, I have a segment that simply copies over a few Bootstrap .js files...
Read more >
Simple Gulp Copy file task (Example) - Coderwall
This is just a handy way of copying a file from one folder to another. There is no goal of replacing other tools...
Read more >
Build and run your project - Write JavaScript for the Web
Let's now build a simple task which takes all HTML files in our project directory and copies them to a dist folder.
Read more >
Getting Started with Gulp.js - Semaphore Tutorial
We will create a simple task to get familiar with basic methods. To copy files, we only need to use the src and...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found