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

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')
);