Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.