<commit_before>var gulp = require('gulp');
var del = require('del');
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;
var url = require('url');
var proxy = require('proxy-middleware');
var modRewrite = require('connect-modrewrite');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var sort = require('gulp-sort');
var addSrc = require('gulp-add-src');
var minifyCss = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var ngHtml2Js = require("gulp-ng-html2js");
var minifyHtml = require("gulp-minify-html");
var argv = require('yargs').argv;
var replace = require('gulp-replace');
var rename = require('gulp-rename');
var fs = require('fs');
var git = require('gulp-git');

var pkg = require('./package.json');

var cssDeps = [
    'node_modules/angular-ui-tree/dist/angular-ui-tree.css',
    'node_modules/font-awesome/css/font-awesome.min.css',
    'node_modules/leaflet.markercluster/dist/MarkerCluster.css',
    'node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css',
    'node_modules/drmonty-leaflet-awesome-markers/css/leaflet.awesome-markers.css',
    'node_modules/angular-ui-swiper/dist/angular-ui-swiper.css',
    'node_modules/leaflet-fullscreen/dist/leaflet.fullscreen.css'
];

var jsDeps = [
    'node_modules/angular/angular.min.js',
    'node_modules/@uirouter/angularjs/release/angular-ui-router.min.js',
    'node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js',
    'node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js',
    'node_modules/leaflet/dist/leaflet.js',
    'node_modules/leaflet.markercluster/dist/leaflet.markercluster.js',
    'lib/oms.min.js',
    'node_modules/drmonty-leaflet-awesome-markers/js/leaflet.awesome-markers.js',
    'node_modules/leaflet.heat/dist/leaflet-heat.js',
    'node_modules/angulartics/dist/angulartics.min.js',
    'node_modules/angulartics-piwik/dist/angulartics-piwik.min.js',
    'node_modules/angular-resource/angular-resource.min.js',
    'node_modules/angular-sanitize/angular-sanitize.min.js',
    'node_modules/angular-cookies/angular-cookies.min.js',
    'node_modules/idai-components/dist/idai-components.min.js',
    'node_modules/angular-ui-tree/dist/angular-ui-tree.min.js',
    'node_modules/showdown/dist/showdown.min.js',
    'node_modules/ng-showdown/dist/ng-showdown.min.js',
    'node_modules/3dviewer/dist/3dviewer.js',
    'lib/relative-paths-in-partial.js',
    'node_modules/d3/build/d3.min.js',
    'node_modules/angular-ui-swiper/dist/angular-ui-swiper.min.js',
    'node_modules/angular-md5/angular-md5.js',
    'node_modules/svg-pan-zoom/dist/svg-pan-zoom.js',
    'node_modules/leaflet-fullscreen/dist/Leaflet.fullscreen.min.js'
];

// compile sass and concatenate to single css file in build dir
gulp.task('compile-css', function () {
    return gulp.src('scss/app.scss')
        .pipe(sass({
            includePaths: [
                'node_modules/bootstrap-sass/assets/stylesheets/',
                'node_modules/idai-components/src/'
            ],
            precision: 8
        }))
        .pipe(addSrc(cssDeps))
	  	.pipe(concat(pkg.name + '.css'))
	    .pipe(gulp.dest('dist/css'));
});

// minify css files in build dir
gulp.task('minify-css', ['compile-css'], function() {
	return gulp.src('dist/css/' + pkg.name + '.css')
		.pipe(minifyCss())
  		.pipe(concat(pkg.name + '.min.css'))
		.pipe(gulp.dest('dist/css'));
});

// concatenates all js files in src into a single file in build dir
gulp.task('concat-js', function() {
	return gulp.src(['app/**/*.js', '!app/app.js'])
		.pipe(sort())
		.pipe(addSrc.append('app/app.js'))
		.pipe(concat(pkg.name + '.js'))
		.pipe(gulp.dest('dist/'));
});

// concatenates and minifies all dependecies into a single file in build dir
gulp.task('concat-deps', function () {
    return gulp.src(jsDeps)
        .pipe(concat(pkg.name + '-deps.js'))
        .pipe(uglify())
        .pipe(gulp.dest('dist/'));
});

// minifies and concatenates js files in build dir
gulp.task('minify-js', ['concat-js', 'html2js-js', 'html2js-partials'], function () {

	var gutil = require('gulp-util');

    return gulp.src(['dist/' + pkg.name + '.js',
        'dist/' + pkg.name + '-partials-tpls.js',
        'dist/' + pkg.name + '-js-tpls.js'
        ])
        .pipe(concat(pkg.name + '.js'))
        .pipe(gulp.dest('dist/'))
        .pipe(uglify())
        //.on('error', function (err) { gutil.log(gutil.colors.red('[Error]'), err.toString()); })
        .pipe(concat(pkg.name + '.min.js'))
        .pipe(gulp.dest('dist/'));
});

gulp.task('html2js-partials', function () {
    return gulp.src('partials/**/*.html')
        .pipe(minifyHtml())
        .pipe(ngHtml2Js({moduleName: 'arachne.partials-templates', prefix: 'partials/'}))
        .pipe(concat(pkg.name + '-partials-tpls.js'))<commit_msg>show erros in minification<commit_after>var gulp = require('gulp');
var del = require('del');
var browserSync = require('browser-sync').create();
var reload = browserSync.reload;
var url = require('url');
var proxy = require('proxy-middleware');
var modRewrite = require('connect-modrewrite');
var sass = require('gulp-sass');
var concat = require('gulp-concat');
var sort = require('gulp-sort');
var addSrc = require('gulp-add-src');
var minifyCss = require('gulp-minify-css');
var uglify = require('gulp-uglify');
var ngHtml2Js = require("gulp-ng-html2js");
var minifyHtml = require("gulp-minify-html");
var argv = require('yargs').argv;
var replace = require('gulp-replace');
var rename = require('gulp-rename');
var fs = require('fs');
var git = require('gulp-git');

var pkg = require('./package.json');

var cssDeps = [
    'node_modules/angular-ui-tree/dist/angular-ui-tree.css',
    'node_modules/font-awesome/css/font-awesome.min.css',
    'node_modules/leaflet.markercluster/dist/MarkerCluster.css',
    'node_modules/leaflet.markercluster/dist/MarkerCluster.Default.css',
    'node_modules/drmonty-leaflet-awesome-markers/css/leaflet.awesome-markers.css',
    'node_modules/angular-ui-swiper/dist/angular-ui-swiper.css',
    'node_modules/leaflet-fullscreen/dist/leaflet.fullscreen.css'
];

var jsDeps = [
    'node_modules/angular/angular.min.js',
    'node_modules/@uirouter/angularjs/release/angular-ui-router.min.js',
    'node_modules/angular-ui-bootstrap/dist/ui-bootstrap-tpls.js',
    'node_modules/angular-ui-bootstrap/dist/ui-bootstrap.js',
    'node_modules/leaflet/dist/leaflet.js',
    'node_modules/leaflet.markercluster/dist/leaflet.markercluster.js',
    'lib/oms.min.js',
    'node_modules/drmonty-leaflet-awesome-markers/js/leaflet.awesome-markers.js',
    'node_modules/leaflet.heat/dist/leaflet-heat.js',
    'node_modules/angulartics/dist/angulartics.min.js',
    'node_modules/angulartics-piwik/dist/angulartics-piwik.min.js',
    'node_modules/angular-resource/angular-resource.min.js',
    'node_modules/angular-sanitize/angular-sanitize.min.js',
    'node_modules/angular-cookies/angular-cookies.min.js',
    'node_modules/idai-components/dist/idai-components.min.js',
    'node_modules/angular-ui-tree/dist/angular-ui-tree.min.js',
    'node_modules/showdown/dist/showdown.min.js',
    'node_modules/ng-showdown/dist/ng-showdown.min.js',
    'node_modules/3dviewer/dist/3dviewer.js',
    'lib/relative-paths-in-partial.js',
    'node_modules/d3/build/d3.min.js',
    'node_modules/angular-ui-swiper/dist/angular-ui-swiper.min.js',
    'node_modules/angular-md5/angular-md5.js',
    'node_modules/svg-pan-zoom/dist/svg-pan-zoom.js',
    'node_modules/leaflet-fullscreen/dist/Leaflet.fullscreen.min.js'
];

// compile sass and concatenate to single css file in build dir
gulp.task('compile-css', function () {
    return gulp.src('scss/app.scss')
        .pipe(sass({
            includePaths: [
                'node_modules/bootstrap-sass/assets/stylesheets/',
                'node_modules/idai-components/src/'
            ],
            precision: 8
        }))
        .pipe(addSrc(cssDeps))
	  	.pipe(concat(pkg.name + '.css'))
	    .pipe(gulp.dest('dist/css'));
});

// minify css files in build dir
gulp.task('minify-css', ['compile-css'], function() {
	return gulp.src('dist/css/' + pkg.name + '.css')
		.pipe(minifyCss())
  		.pipe(concat(pkg.name + '.min.css'))
		.pipe(gulp.dest('dist/css'));
});

// concatenates all js files in src into a single file in build dir
gulp.task('concat-js', function() {
	return gulp.src(['app/**/*.js', '!app/app.js'])
		.pipe(sort())
		.pipe(addSrc.append('app/app.js'))
		.pipe(concat(pkg.name + '.js'))
		.pipe(gulp.dest('dist/'));
});

// concatenates and minifies all dependecies into a single file in build dir
gulp.task('concat-deps', function () {
    return gulp.src(jsDeps)
        .pipe(concat(pkg.name + '-deps.js'))
        .pipe(uglify())
        .pipe(gulp.dest('dist/'));
});

// minifies and concatenates js files in build dir
gulp.task('minify-js', ['concat-js', 'html2js-js', 'html2js-partials'], function () {

	var gutil = require('gulp-util');

    return gulp.src(['dist/' + pkg.name + '.js',
        'dist/' + pkg.name + '-partials-tpls.js',
        'dist/' + pkg.name + '-js-tpls.js'
        ])
        .pipe(concat(pkg.name + '.js'))
        .pipe(gulp.dest('dist/'))
        .pipe(uglify())
        .on('error', function (err) { gutil.log(gutil.colors.red('[Error]'), err.toString()); })
        .pipe(concat(pkg.name + '.min.js'))
        .pipe(gulp.dest('dist/'));
});

gulp.task('html2js-partials', function () {
    return gulp.src('partials/**/*.html')
        .pipe(minifyHtml())
        .pipe(ngHtml2Js({moduleName: 'arachne.partials-templates', prefix: 'partials/'}))
        .pipe(concat(pkg.name + '-partials-tpls.js'))
{'fraction_non_alphanumeric': 0.18631611634406375, 'fraction_numerical': 0.0026912327916364764, 'mean_word_length': 3.5532516493873705, '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': '1395494', 'n_tokens_mistral': 3531, 'n_tokens_neox': 3478, 'n_words': 468}