简体   繁体   中英

How to copy static html pages in gulp

I am using nunjucks for my project. Now I have one HTML site with its own assets. I need to have it in my path url/static_pages/page .

But if I only copy it in the pages folder, the gulp build does not recognise it.

How can I make a simple gulp task that would copy the files from for example pages/static_pages/ into the /dist folder and have it on my correct path?

Thanks

Here an example a gulp task to copy html pages:

gulp.html.js

module.exports.copy = function(){
    var src = [];
        src.push('static_pages/page/*.html');

    var dist = 'dist/pages/static_pages';

    return gulp.src(src)
        .pipe(gulp.dest(dist));

};

gulpfile.js

var html = require('gulp.html');
gulptask('htmlcopy', html.copy);

You need to check your paths on your own. I cannot see if you use the right paths.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM