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

Ryan Doran
Ryan Doran
7,815 Points

Won't create dist folder

This does everything write, and the terminal runs completely, but no 'dist' folder is created. Please help.

'use strict';

var gulp = require('gulp');
var concat = require('gulp-concat');
var uglify = require('gulp-uglify');
var rename = require('gulp-rename');
var sass = require('gulp-sass');
var maps = require('gulp-sourcemaps');
var del = require('del');

gulp.task('concatScripts', function(done) {
    return gulp.src([
        'js/jquery.js',
        'js/sticky/jquery.sticky.js',
        'js/main.js'])
    .pipe(maps.init())
    .pipe(concat('app.js'))
    .pipe(maps.write('./'))
    .pipe(gulp.dest('js'));
    done();
});

gulp.task('minifyScripts', function(done){
    gulp.src('js/app.js')
    .pipe(uglify())
    .pipe(rename('app.min.js'))
    .pipe(gulp.dest('js'))
    done();
});

gulp.task('compileSass', function(done){
    gulp.src('scss/application.scss')
    .pipe(maps.init())
    .pipe(sass())
    .pipe(maps.write('./'))
    .pipe(gulp.dest('css'))
    done();
});

gulp.task('watchSass', function(done){
    gulp.watch('scss/**/*.scss', gulp.series('compileSass'));
    done();
});

gulp.task('build', gulp.series('concatScripts', 'minifyScripts', 'compileSass'),
function(done){
    return gulp.src(['css/application.css', 'js/app.min.js', 'index.html', 'img/**', 'fonts/**', {base: './'}])
    .pipe(gulp.dest('dist'));
    done;
});

gulp.task('clean', function(done){
    del(['dist', 'css/application.css*', 'js/app*.js*']);
    done();
});

gulp.task('default', gulp.series('clean', 'build')
);