<commit_before>/*jshint esversion: 6 */

var gulp  = require('gulp'),
  uglify  = require('gulp-uglify'),
  less = require('gulp-less'),
  minifyCSS = require('gulp-clean-css'),
  rename = require("gulp-rename");

var libs = {
  'jquery':     [
    'dist/jquery.min.js',
    'dist/jquery.min.map'
  ],
  'bootstrap':  [
    'dist/css/bootstrap.min.css',
    'dist/css/bootstrap.css.map',
    'dist/js/bootstrap.min.js'
  ],
  'bootstrap3':  [
    'dist/css/bootstrap.min.css',
    'dist/css/bootstrap.css.map',
    'dist/fonts/*',
    'dist/js/bootstrap.min.js',
    'less/**/*'
  ],
  'bootstrap-datepicker':  [
    'dist/css/bootstrap-datepicker3.min.css',
    'dist/js/bootstrap-datepicker.min.js',
    'dist/locales/*'
  ],
  'datatables.net':  [
    'js/jquery.dataTables.min.js'
  ],
  'datatables.net-bs':  [
    '**/*.min.*'
  ],
  'google-code-prettify':  [
    'bin/*'
  ],
  'jquery-nestable':  [
    'jquery.nestable.js'
  ],
  '@fancyapps': [
    'fancybox/dist/*.min.*'
  ],
  'tinymce': [
    "plugins/*/plugin.min.js",
    "plugins/*/plugin.js",
    "skins/**/*",
    "themes/**/*",
    "tinymce.min*",
    "tinymce.js"
  ],
  'fine-uploader': [
    "fine-uploader/*.gif",
    "fine-uploader/fine-uploader.min.js",
    "fine-uploader/fine-uploader.min.css"
  ],
  "font-awesome": [
    "fonts/*",
    "css/font-awesome.min*"
  ],
  "jquery-mousewheel": [
    "jquery.mousewheel.js"
  ],
  "pnotify": [
    'dist/pnotify.js',
    'dist/pnotify.css'
  ],
  "select2": [
    "dist/css/select2.min.css",
    "dist/js/*min.js",
    "dist/js/i18n/*"
  ],
  "select2-bootstrap-theme": [
    "dist/*.min.css"
  ]
};

gulp.task('moveLibs', function(done){
  Object.entries(libs).forEach(([key, vals]) => {
    vals.forEach( (v) => {
      gulp.src(`node_modules/${key}/${v}`, {base: `./node_modules/`})
        .pipe(gulp.dest(`./frontLibs/`));
    });
  });
  done();
});


gulp.task('frontCSS', function () {
  return gulp.src('sites/default/css/styles.less')
  .pipe(less().on('error', function(err){ console.log(err.message); }))
  .pipe(minifyCSS())
  .pipe(gulp.dest('sites/default/css/'));
});

gulp.task('adminCSS', function () {
  return gulp.src('less/admin.less')
  .pipe(less().on('error', function(err){ console.log(err.message); }))
  .pipe(minifyCSS())
  .pipe(gulp.dest('css/'));
});

gulp.task('adminJS', function(){
  return gulp.src('./js/admin.js')
    .pipe(uglify())
    .pipe(rename({ suffix: '.min' }))
    .pipe(gulp.dest('./js/'));
});


gulp.task('default', function(){
  gulp.watch(['./js/admin.js'], gulp.series('adminJS'));
  gulp.watch(['less/admin.less'], gulp.series('adminCSS'));
  gulp.watch('sites/default/css/*.less', gulp.series('frontCSS'));<commit_msg>Better gulp-less error handling<commit_after>/*jshint esversion: 6 */

const gulp  = require('gulp'),
  uglify  = require('gulp-uglify'),
  less = require('gulp-less'),
  minifyCSS = require('gulp-clean-css'),
  rename = require("gulp-rename");

const libs = {
  'jquery':     [
    'dist/jquery.min.js',
    'dist/jquery.min.map'
  ],
  'bootstrap':  [
    'dist/css/bootstrap.min.css',
    'dist/css/bootstrap.css.map',
    'dist/js/bootstrap.min.js'
  ],
  'bootstrap3':  [
    'dist/css/bootstrap.min.css',
    'dist/css/bootstrap.css.map',
    'dist/fonts/*',
    'dist/js/bootstrap.min.js',
    'less/**/*'
  ],
  'bootstrap-datepicker':  [
    'dist/css/bootstrap-datepicker3.min.css',
    'dist/js/bootstrap-datepicker.min.js',
    'dist/locales/*'
  ],
  'datatables.net':  [
    'js/jquery.dataTables.min.js'
  ],
  'datatables.net-bs':  [
    '**/*.min.*'
  ],
  'google-code-prettify':  [
    'bin/*'
  ],
  'jquery-nestable':  [
    'jquery.nestable.js'
  ],
  '@fancyapps': [
    'fancybox/dist/*.min.*'
  ],
  'tinymce': [
    "plugins/*/plugin.min.js",
    "plugins/*/plugin.js",
    "skins/**/*",
    "themes/**/*",
    "tinymce.min*",
    "tinymce.js"
  ],
  'fine-uploader': [
    "fine-uploader/*.gif",
    "fine-uploader/fine-uploader.min.js",
    "fine-uploader/fine-uploader.min.css"
  ],
  "font-awesome": [
    "fonts/*",
    "css/font-awesome.min*"
  ],
  "jquery-mousewheel": [
    "jquery.mousewheel.js"
  ],
  "pnotify": [
    'dist/pnotify.js',
    'dist/pnotify.css'
  ],
  "select2": [
    "dist/css/select2.min.css",
    "dist/js/*min.js",
    "dist/js/i18n/*"
  ],
  "select2-bootstrap-theme": [
    "dist/*.min.css"
  ]
};

gulp.task('moveLibs', function(done){
  Object.entries(libs).forEach(([key, vals]) => {
    vals.forEach( (v) => {
      gulp.src(`node_modules/${key}/${v}`, {base: `./node_modules/`})
        .pipe(gulp.dest(`./frontLibs/`));
    });
  });
  done();
});


gulp.task('frontCSS', function () {
  return gulp.src('sites/default/css/styles.less')
  .pipe(less().on('error', function(err){ console.log(err.message); this.emit('end'); }))
  .pipe(minifyCSS())
  .pipe(gulp.dest('sites/default/css/'));
});

gulp.task('adminCSS', function () {
  return gulp.src('less/admin.less')
  .pipe(less().on('error', function(err){ console.log(err.message); this.emit('end'); }))
  .pipe(minifyCSS())
  .pipe(gulp.dest('css/'));
});

gulp.task('adminJS', function(){
  return gulp.src('./js/admin.js')
    .pipe(uglify())
    .pipe(rename({ suffix: '.min' }))
    .pipe(gulp.dest('./js/'));
});


gulp.task('default', function(){
  gulp.watch(['./js/admin.js'], gulp.series('adminJS'));
  gulp.watch(['less/admin.less'], gulp.series('adminCSS'));
  gulp.watch('sites/default/css/*.less', gulp.series('frontCSS'));
{'fraction_non_alphanumeric': 0.24945014662756598, 'fraction_numerical': 0.002932551319648094, 'mean_word_length': 3.0154525386313464, 'pattern_counts': {'":': 10, '<': 3, '<?xml version=': 0, '>': 7, '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': '7604487', 'n_tokens_mistral': 2256, 'n_tokens_neox': 2208, 'n_words': 232}