Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Gulp Basics Improving your Gulp Task Pipelines The Build and Development Pipeline

Gulp build does not add index.html and img into dist folder?

Hi,

I am following The Build and Development Pipeline video and my index.html and img folder are not appearing within the dist folder with gulp build command

This is my current folder structure:

-/landing-page
-/bower_components
.......boostrap
.......jquery
.......tether
-/dist
.......css
.......js
-/node_modules
-/src
-/img
-/js
-/scss
.......base
.......components
.......layout
app.scss

index.html
bower.json
gulpfile.js
package.json
gulp.task("build", ['minifyScripts', 'compileSass'], function() {
   return gulp.src(['css/app.css', 'js/app.min.js', 'index.html',
                    'img/**'], { base: './'})
       .pipe(gulp.dest('dist'));
});

Is there anything I am missing for the index.html file which is on the root of my src directory and img directory which is also in the src directory to not be included in the dist folder?

I also wanted to know if the image and html would be optimised through this task?

Thank you

1 Answer

Edgar Cerecerez
Edgar Cerecerez
1,983 Points

compilesass and minify-scripts look for css and javascript files. They don't touch images nor html, so the output to dist doesn't include them.

For html, you could minify it, make it part of your build process, but I've read conflicting posts about how accurate it is, if you want to try, look into gulp-htmlmin.