<commit_before>/* Modules */
var gulp           = require('gulp');
var del            = require('del');
var browserSync    = require('browser-sync');
var reload         = browserSync.reload;
var plugins        = require('gulp-load-plugins')();
var runSequence    = require('run-sequence');
var fs             = require('fs');

/* Paths */
var paths = {
    dist: './dist',
    styles: {
        source: './source/styles/**/*.scss',
        dest: './source/styles'
    },
    templates: {
        source: './source/templates/*.html',
        dest: './dist/templates',
        destBare: './dist/templates/bare'
    },
    tmp: './.tmp/'
};

/* Config */
var config = {
    browserSync: {
        baseDir: './.tmp',
        startPath: '/templates'
    },
    nunjucks: {
        templates: './source/templates/snippets/'
    }
}

plugins.nunjucksRender.nunjucks.configure([config.nunjucks.templates]);

/* Setup */
gulp.task('setup', function() {
    if (!fs.existsSync('./source/')) {
        return gulp.src('./core/source/**/*')
        .pipe(gulp.dest('./source/'))
    }
})

/* Clean: Dist */
gulp.task('clean:dist', function() {
    return del(paths.dist);
})

/* Clean: Tmp */
gulp.task('clean:tmp', function() {
    return del(paths.tmp);
})

/* Clean */
gulp.task('clean', ['clean:dist', 'clean:tmp']);

/* Build Styles */
gulp.task('build:styles', function () {
    return gulp.src(paths.styles.source)
    .pipe(plugins.sass({
        outputStyle: 'compressed'
    }))
    .pipe(gulp.dest(paths.styles.dest));
});

/* Build: Templates */
gulp.task('build:templates', ['build:styles'], function() {
    return gulp.src(paths.templates.source)
    .pipe(plugins.nunjucksRender())
    .pipe(plugins.inlineCss({
        preserveMediaQueries: true,
    }))
    .pipe(gulp.dest(paths.templates.dest));
});

/* Build: Templates Bare */
gulp.task('build:templates-bare', ['build:styles'], function() {
    return gulp.src(paths.templates.source)
    .pipe(plugins.nunjucksRender())
    .pipe(plugins.inlineSource())
    .pipe(gulp.dest(paths.templates.destBare));
});

/* Serve: Browser Sync */
gulp.task('serve:browser-sync', function() {
    return browserSync({
        server: {
            baseDir: config.browserSync.baseDir,
            directory: true,
        },
        startPath: config.browserSync.startPath
    });
});

/* Serve: Styles */
gulp.task('serve:styles', function () {
    return gulp.src(paths.styles.source)
    .pipe(plugins.sass({
        outputStyle: 'compressed'
    }))
    .pipe(gulp.dest(paths.tmp + 'styles/'))
    .pipe(reload({stream:true}));
});

/* Serve: Nunjucks Gen */
gulp.task('serve:nunjucks-gen', function() {
    return gulp.src(paths.templates.source)
    .pipe(plugins.nunjucksRender())
    .pipe(gulp.dest(paths.tmp + 'templates/'));
});

gulp.task('serve:watch', function() {
    gulp.watch(paths.styles.source, ['serve:styles']);
    gulp.watch(paths.templates.source, ['serve:nunjucks-gen', browserSync.reload]);
    gulp.watch(config.nunjucks.templates + '**/*.html', ['serve:nunjucks-gen', browserSync.reload]);
})

/* Serve */
gulp.task('serve', function(callback) {
    runSequence(
        'setup',
        'clean:tmp',
        'serve:styles',
        'serve:nunjucks-gen',
        'serve:browser-sync',
        'serve:watch',
        callback
    );

});

/* Build */
gulp.task('build', function(callback) {
    runSequence(
        'setup',
        'clean:dist',
        'build:templates',
        'build:templates-bare'
    );
});

/* Default */
gulp.task('default', ['serve']);
<commit_msg>Add missing comment for server: watch task.<commit_after>/* Modules */
var gulp           = require('gulp');
var del            = require('del');
var browserSync    = require('browser-sync');
var reload         = browserSync.reload;
var plugins        = require('gulp-load-plugins')();
var runSequence    = require('run-sequence');
var fs             = require('fs');

/* Paths */
var paths = {
    dist: './dist',
    styles: {
        source: './source/styles/**/*.scss',
        dest: './source/styles'
    },
    templates: {
        source: './source/templates/*.html',
        dest: './dist/templates',
        destBare: './dist/templates/bare'
    },
    tmp: './.tmp/'
};

/* Config */
var config = {
    browserSync: {
        baseDir: './.tmp',
        startPath: '/templates'
    },
    nunjucks: {
        templates: './source/templates/snippets/'
    }
}

plugins.nunjucksRender.nunjucks.configure([config.nunjucks.templates]);

/* Setup */
gulp.task('setup', function() {
    if (!fs.existsSync('./source/')) {
        return gulp.src('./core/source/**/*')
        .pipe(gulp.dest('./source/'))
    }
})

/* Clean: Dist */
gulp.task('clean:dist', function() {
    return del(paths.dist);
})

/* Clean: Tmp */
gulp.task('clean:tmp', function() {
    return del(paths.tmp);
})

/* Clean */
gulp.task('clean', ['clean:dist', 'clean:tmp']);

/* Build Styles */
gulp.task('build:styles', function () {
    return gulp.src(paths.styles.source)
    .pipe(plugins.sass({
        outputStyle: 'compressed'
    }))
    .pipe(gulp.dest(paths.styles.dest));
});

/* Build: Templates */
gulp.task('build:templates', ['build:styles'], function() {
    return gulp.src(paths.templates.source)
    .pipe(plugins.nunjucksRender())
    .pipe(plugins.inlineCss({
        preserveMediaQueries: true,
    }))
    .pipe(gulp.dest(paths.templates.dest));
});

/* Build: Templates Bare */
gulp.task('build:templates-bare', ['build:styles'], function() {
    return gulp.src(paths.templates.source)
    .pipe(plugins.nunjucksRender())
    .pipe(plugins.inlineSource())
    .pipe(gulp.dest(paths.templates.destBare));
});

/* Serve: Browser Sync */
gulp.task('serve:browser-sync', function() {
    return browserSync({
        server: {
            baseDir: config.browserSync.baseDir,
            directory: true,
        },
        startPath: config.browserSync.startPath
    });
});

/* Serve: Styles */
gulp.task('serve:styles', function () {
    return gulp.src(paths.styles.source)
    .pipe(plugins.sass({
        outputStyle: 'compressed'
    }))
    .pipe(gulp.dest(paths.tmp + 'styles/'))
    .pipe(reload({stream:true}));
});

/* Serve: Nunjucks Gen */
gulp.task('serve:nunjucks-gen', function() {
    return gulp.src(paths.templates.source)
    .pipe(plugins.nunjucksRender())
    .pipe(gulp.dest(paths.tmp + 'templates/'));
});

/* Serve: Watch */
gulp.task('serve:watch', function() {
    gulp.watch(paths.styles.source, ['serve:styles']);
    gulp.watch(paths.templates.source, ['serve:nunjucks-gen', browserSync.reload]);
    gulp.watch(config.nunjucks.templates + '**/*.html', ['serve:nunjucks-gen', browserSync.reload]);
})

/* Serve */
gulp.task('serve', function(callback) {
    runSequence(
        'setup',
        'clean:tmp',
        'serve:styles',
        'serve:nunjucks-gen',
        'serve:browser-sync',
        'serve:watch',
        callback
    );

});

/* Build */
gulp.task('build', function(callback) {
    runSequence(
        'setup',
        'clean:dist',
        'build:templates',
        'build:templates-bare'
    );
});

/* Default */
gulp.task('default', ['serve']);

{'fraction_non_alphanumeric': 0.19787442315760034, 'fraction_numerical': 0.0, 'mean_word_length': 2.7642105263157895, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3974017', 'n_tokens_mistral': 2379, 'n_tokens_neox': 2357, 'n_words': 368}