<commit_before>var gulp = require('gulp');

// Now the rest of the dependencies
var uglify = require('gulp-uglify');
var minifyCss = require('gulp-minify-css');
var del = require('del');
var concat = require('gulp-concat');
var jshint = require('gulp-jshint');
var plumber = require('gulp-plumber');
var cssPrefixed = require('gulp-autoprefixer');
var server = require('gulp-server-livereload');
var changed = require('gulp-changed');
var fs = require('fs');
var phpServer = require('gulp-connect-php');

// constants goes here
const WORDPRESS_THEME = 'smash-norge';

// Clean build folder
gulp.task('clean', function(cb) {
    del(['dist/assets/scripts.min.js', 'dist/assets/styles.min.css'], cb);
});

// Handle frontend JS build
gulp.task('script', ['clean'], function () {
    return gulp.src('src/js/*.js')
        .pipe(plumber())
        .pipe(jshint())
        .pipe(uglify())
        .pipe(concat('scripts.min.js'))
        .pipe(gulp.dest('dist/assets/'));

});

// Handle CSS build
gulp.task('style', ['clean'], function () {
    return gulp.src('src/css/*.css')
        .pipe(plumber())
        .pipe(cssPrefixed({browsers: ['last 2 versions'], cascade: false}))
        .pipe(minifyCss())
        .pipe(concat('styles.min.css'))
        .pipe(gulp.dest('dist/assets/'));
});

// Bower tasks
gulp.task('bower', ['bower:css', 'bower:js', 'bower:fonts'], function() {
    console.log('bower tasks completed');
});

gulp.task('bower:js', ['clean'], function () {
    return gulp.src('bower_components/**/*.min.js')
        .pipe(changed('vendor.min.js'))
        .pipe(concat('vendor.min.js'))
        .pipe(gulp.dest('dist/assets/'));
});

gulp.task('bower:css', ['clean'], function () {
    return gulp.src('bower_components/**/*.min.css')
        .pipe(changed('vendor.min.css'))
        .pipe(concat('vendor.min.css'))
        .pipe(gulp.dest('dist/assets/'));
});

gulp.task('bower:fonts', ['clean'], function () {
    return gulp.src(['bower_components/bootstrap/dist/fonts/*'])
        .pipe(changed('dist/fonts'))
        .pipe(gulp.dest('dist/fonts'));
});

gulp.task('images', function () {
    return gulp.src('src/img/**')
        .pipe(changed('dist/assets/img'))
        .pipe(gulp.dest('dist/assets/img'));
});

gulp.task('html', function() {
    return gulp.src('src/*.html')
        .pipe(changed('dist/*.html'))
        .pipe(gulp.dest('dist'));
});

// Development server @ localhost:8000
gulp.task('server', function () {
    return gulp.src('dist')
        .pipe(server({
            livereload: false,
            open: true,
            log: 'debug'
        }));
});

// Prompt
gulp.task('prompt', function () {
    return fs.readFile('prompt.txt', 'utf8', function (err, data) {
        if (err) {
            throw err;
        }
        console.log(data);
    });
});

// Wordpress tasks
gulp.task('wordpress:theme', ['compile'], function() {
    var assetsOutputPath = 'theme/assets';
    gulp.src('dist/assets/**')
        .pipe(changed(assetsOutputPath))
        .pipe(gulp.dest(assetsOutputPath));
    var fontsOutputPath = 'theme/fonts';
    gulp.src('dist/fonts/**')
        .pipe(changed(fontsOutputPath))
        .pipe(gulp.dest(fontsOutputPath));
});

gulp.task('wordpress', ['wordpress:theme'], function () {
    var outputPath = 'wordpress/wp-content/themes/' + WORDPRESS_THEME;
    return gulp.src('theme/**')
        .pipe(changed(outputPath))
        .pipe(gulp.dest(outputPath));
});

// Watch for updates in files to recompile assets
gulp.task('watch', function () {
    gulp.watch('src/*.html', ['html']);
    gulp.watch('src/js/*.js', ['script']);
    gulp.watch('src/css/*.css', ['style']);
    gulp.watch('theme/', ['wordpress']);
    gulp.watch('bower.json', ['bower']);
});

gulp.task('compile', ['html', 'script', 'style', 'bower', 'images']);
gulp.task('serve:local', ['compile', 'watch', 'server']);
gulp.task('serve:wordpress', ['wordpress', 'watch'], function() {
    phpServer.server({port: 8000, base: 'wordpress', open: true});
});
gulp.task('smash', ['prompt', 'serve']);
gulp.task('default', ['wordpress']);
<commit_msg>watch for theme files<commit_after>var gulp = require('gulp');

// Now the rest of the dependencies
var uglify = require('gulp-uglify');
var minifyCss = require('gulp-minify-css');
var del = require('del');
var concat = require('gulp-concat');
var jshint = require('gulp-jshint');
var plumber = require('gulp-plumber');
var cssPrefixed = require('gulp-autoprefixer');
var server = require('gulp-server-livereload');
var changed = require('gulp-changed');
var fs = require('fs');
var phpServer = require('gulp-connect-php');

// constants goes here
const WORDPRESS_THEME = 'smash-norge';

// Clean build folder
gulp.task('clean', function(cb) {
    del(['dist/assets/scripts.min.js', 'dist/assets/styles.min.css'], cb);
});

// Handle frontend JS build
gulp.task('script', ['clean'], function () {
    return gulp.src('src/js/*.js')
        .pipe(plumber())
        .pipe(jshint())
        .pipe(uglify())
        .pipe(concat('scripts.min.js'))
        .pipe(gulp.dest('dist/assets/'));

});

// Handle CSS build
gulp.task('style', ['clean'], function () {
    return gulp.src('src/css/*.css')
        .pipe(plumber())
        .pipe(cssPrefixed({browsers: ['last 2 versions'], cascade: false}))
        .pipe(minifyCss())
        .pipe(concat('styles.min.css'))
        .pipe(gulp.dest('dist/assets/'));
});

// Bower tasks
gulp.task('bower', ['bower:css', 'bower:js', 'bower:fonts'], function() {
    console.log('bower tasks completed');
});

gulp.task('bower:js', ['clean'], function () {
    return gulp.src('bower_components/**/*.min.js')
        .pipe(changed('vendor.min.js'))
        .pipe(concat('vendor.min.js'))
        .pipe(gulp.dest('dist/assets/'));
});

gulp.task('bower:css', ['clean'], function () {
    return gulp.src('bower_components/**/*.min.css')
        .pipe(changed('vendor.min.css'))
        .pipe(concat('vendor.min.css'))
        .pipe(gulp.dest('dist/assets/'));
});

gulp.task('bower:fonts', ['clean'], function () {
    return gulp.src(['bower_components/bootstrap/dist/fonts/*'])
        .pipe(changed('dist/fonts'))
        .pipe(gulp.dest('dist/fonts'));
});

gulp.task('images', function () {
    return gulp.src('src/img/**')
        .pipe(changed('dist/assets/img'))
        .pipe(gulp.dest('dist/assets/img'));
});

gulp.task('html', function() {
    return gulp.src('src/*.html')
        .pipe(changed('dist/*.html'))
        .pipe(gulp.dest('dist'));
});

// Development server @ localhost:8000
gulp.task('server', function () {
    return gulp.src('dist')
        .pipe(server({
            livereload: false,
            open: true,
            log: 'debug'
        }));
});

// Prompt
gulp.task('prompt', function () {
    return fs.readFile('prompt.txt', 'utf8', function (err, data) {
        if (err) {
            throw err;
        }
        console.log(data);
    });
});

// Wordpress tasks
gulp.task('wordpress:theme', ['compile'], function() {
    var assetsOutputPath = 'theme/assets';
    gulp.src('dist/assets/**')
        .pipe(changed(assetsOutputPath))
        .pipe(gulp.dest(assetsOutputPath));
    var fontsOutputPath = 'theme/fonts';
    gulp.src('dist/fonts/**')
        .pipe(changed(fontsOutputPath))
        .pipe(gulp.dest(fontsOutputPath));
});

gulp.task('wordpress', ['wordpress:theme'], function () {
    var outputPath = 'wordpress/wp-content/themes/' + WORDPRESS_THEME;
    return gulp.src('theme/**')
        .pipe(changed(outputPath))
        .pipe(gulp.dest(outputPath));
});

// Watch for updates in files to recompile assets
gulp.task('watch', function () {
    gulp.watch('src/*.html', ['html']);
    gulp.watch('src/js/*.js', ['script']);
    gulp.watch('src/css/*.css', ['style']);
    gulp.watch('theme/*.php', ['wordpress']);
    gulp.watch('bower.json', ['bower']);
});

gulp.task('compile', ['html', 'script', 'style', 'bower', 'images']);
gulp.task('serve:local', ['compile', 'watch', 'server']);
gulp.task('serve:wordpress', ['wordpress', 'watch'], function() {
    phpServer.server({port: 8000, base: 'wordpress', open: true});
});
gulp.task('smash', ['prompt', 'serve']);
gulp.task('default', ['wordpress']);

{'fraction_non_alphanumeric': 0.22132649322096007, 'fraction_numerical': 0.002442897276169537, 'mean_word_length': 3.4187803561791688, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1485667', 'n_tokens_mistral': 2804, 'n_tokens_neox': 2731, 'n_words': 471}