complianz-gdpr
Last commit date
DNSMPD
2 months ago
assets
2 months ago
config
2 months ago
cookie
2 months ago
cookiebanner
2 months ago
cron
7 months ago
documents
2 months ago
gutenberg
7 months ago
integrations
2 months ago
languages
2 months ago
mailer
1 year ago
onboarding
1 year ago
placeholders
7 months ago
progress
2 years ago
proof-of-consent
2 years ago
rest-api
1 year ago
settings
2 months ago
templates
6 months ago
upgrade
6 months ago
websitescan
2 months ago
LICENSE.txt
4 years ago
README.md
7 months ago
class-admin.php
6 months ago
class-company.php
2 years ago
class-cookie-blocker.php
7 months ago
class-document.php
1 year ago
class-export.php
2 years ago
class-field.php
1 year ago
class-installer.php
2 years ago
class-review.php
11 months ago
class-wizard.php
1 year ago
complianz-gpdr.php
2 months ago
composer.json
1 year ago
functions-legacy.php
2 years ago
functions.php
2 months ago
gulpfile.js
1 year ago
index.php
7 years ago
loco.xml
4 years ago
readme.txt
2 months ago
security.md
2 years ago
system-status.php
1 year ago
uninstall.php
2 months ago
upgrade.php
2 months ago
gulpfile.js
131 lines
| 1 | const gulp = require('gulp'); |
| 2 | const rtlcss = require('gulp-rtlcss'); |
| 3 | const concat = require('gulp-concat'); |
| 4 | const cssbeautify = require('gulp-cssbeautify'); |
| 5 | const cssuglify = require('gulp-uglifycss'); |
| 6 | const jsuglify = require('gulp-uglify'); |
| 7 | const sass = require('gulp-sass')(require('sass')); |
| 8 | const spawn = require('child_process').spawn; |
| 9 | |
| 10 | /** |
| 11 | * Watches for changes in specific JavaScript and SCSS files and triggers the corresponding build tasks. |
| 12 | * Also starts an npm process in the 'settings' directory. |
| 13 | * |
| 14 | */ |
| 15 | function defaultTask(cb) { |
| 16 | gulp.watch('./assets/css/document.scss', { ignoreInitial: false }, buildCssDocument); |
| 17 | // Watch for changes in 'document-grid.scss' and run 'buildCssDocumentGrid' task |
| 18 | gulp.watch('./assets/css/document-grid.scss', { ignoreInitial: false }, buildCssDocumentGrid); |
| 19 | // Watch for changes in 'admin.scss' and run 'buildCssAdmin' task |
| 20 | gulp.watch('./assets/css/admin.scss', { ignoreInitial: false }, buildCssAdmin); |
| 21 | // Watch for changes in 'cookieblocker.scss' and run 'buildCssCookieblocker' task |
| 22 | gulp.watch('./assets/css/cookieblocker.scss', { ignoreInitial: false }, buildCssCookieblocker); |
| 23 | // Watch for changes in JavaScript files in the 'cookiebanner/js' directory and run 'buildJsCookiebanner' task |
| 24 | gulp.watch('./cookiebanner/js/complianz.js', { ignoreInitial: false }, buildJsCookiebanner); |
| 25 | // Watch for changes in 'document.scss' and run 'buildCssDocument' task |
| 26 | // Start an npm process in the 'settings' directory |
| 27 | // spawn('npm', ['start'], { cwd: 'settings', stdio: 'inherit' }); |
| 28 | // Signal completion |
| 29 | cb(); |
| 30 | } |
| 31 | exports.default = defaultTask |
| 32 | |
| 33 | /** |
| 34 | * Builds the Cookiebanner JavaScript files by concatenating and minifying them. |
| 35 | * |
| 36 | */ |
| 37 | function buildJsCookiebanner() { |
| 38 | return gulp.src('cookiebanner/js/complianz.js') |
| 39 | .pipe(concat('complianz.min.js')) |
| 40 | .pipe(jsuglify()) |
| 41 | .pipe(gulp.dest('./cookiebanner/js')); // Final output for minified version |
| 42 | } |
| 43 | exports['build:js:cookiebanner'] = buildJsCookiebanner; |
| 44 | |
| 45 | /** |
| 46 | * Builds all JavaScript files by running the specified tasks in series. |
| 47 | * |
| 48 | */ |
| 49 | function buildJsAll(cb) { |
| 50 | return gulp.series( |
| 51 | buildJsCookiebanner |
| 52 | )(cb); |
| 53 | } |
| 54 | exports['build:js:all'] = buildJsAll; |
| 55 | |
| 56 | /** |
| 57 | * Builds all CSS files by running the specified tasks in series. |
| 58 | * |
| 59 | */ |
| 60 | function buildCssAll(cb) { |
| 61 | return gulp.series( |
| 62 | buildCssDocument, |
| 63 | buildCssDocumentGrid, |
| 64 | buildCssAdmin, |
| 65 | buildCssCookieblocker, |
| 66 | )(cb); |
| 67 | } |
| 68 | exports['build:css:all'] = buildCssAll; |
| 69 | |
| 70 | /** |
| 71 | * Builds the Document CSS by compiling SCSS to CSS, beautifying, minifying. |
| 72 | * |
| 73 | */ |
| 74 | function buildCssDocument() { |
| 75 | return gulp.src('./assets/css/document.scss') |
| 76 | .pipe(sass(({outputStyle: 'expanded'})).on('error', sass.logError)) |
| 77 | .pipe(cssbeautify()) // Beautify the CSS |
| 78 | .pipe(gulp.dest('./assets/css')) |
| 79 | .pipe(cssuglify()) // Minify the CSS |
| 80 | .pipe(concat('document.min.css')) |
| 81 | .pipe(gulp.dest('./assets/css')); |
| 82 | } |
| 83 | exports['build:css:document'] = buildCssDocument; |
| 84 | |
| 85 | /** |
| 86 | * Builds the DocumentGrid CSS by compiling SCSS to CSS, beautifying, minifying. |
| 87 | * |
| 88 | */ |
| 89 | function buildCssDocumentGrid() { |
| 90 | return gulp.src('./assets/css/document-grid.scss') |
| 91 | .pipe(sass(({outputStyle: 'expanded'})).on('error', sass.logError)) |
| 92 | .pipe(cssbeautify()) // Beautify the CSS |
| 93 | .pipe(gulp.dest('./assets/css')) |
| 94 | .pipe(cssuglify()) // Minify the CSS |
| 95 | .pipe(concat('document-grid.min.css')) |
| 96 | .pipe(gulp.dest('./assets/css')); |
| 97 | } |
| 98 | exports['build:css:document-grid'] = buildCssDocumentGrid; |
| 99 | |
| 100 | /** |
| 101 | * Builds the Admin CSS by compiling SCSS to CSS, beautifying, minifying, and generating RTL CSS. |
| 102 | * |
| 103 | */ |
| 104 | function buildCssAdmin() { |
| 105 | return gulp.src('./assets/css/admin.scss') |
| 106 | .pipe(sass(({outputStyle: 'expanded'})).on('error', sass.logError)) |
| 107 | .pipe(cssbeautify()) // Beautify the CSS |
| 108 | .pipe(gulp.dest('./assets/css')) |
| 109 | .pipe(cssuglify()) // Minify the CSS |
| 110 | .pipe(concat('admin.min.css')) |
| 111 | .pipe(gulp.dest('./assets/css')) |
| 112 | .pipe(rtlcss()) |
| 113 | .pipe(gulp.dest('./assets/css/rtl')); |
| 114 | } |
| 115 | exports['build:css:admin'] = buildCssAdmin; |
| 116 | |
| 117 | /** |
| 118 | * Builds the Cookieblocker CSS by compiling SCSS to CSS, beautifying, minifying. |
| 119 | * |
| 120 | */ |
| 121 | function buildCssCookieblocker() { |
| 122 | |
| 123 | return gulp.src('./assets/css/cookieblocker.scss') |
| 124 | .pipe(sass(({outputStyle: 'expanded'})).on('error', sass.logError)) |
| 125 | .pipe(cssbeautify()) // Beautify the CSS |
| 126 | .pipe(gulp.dest('./assets/css')) |
| 127 | .pipe(cssuglify()) // Minify the CSS |
| 128 | .pipe(concat('cookieblocker.min.css')) |
| 129 | .pipe(gulp.dest('./assets/css')); |
| 130 | } |
| 131 | exports['build:css:cookieblocker'] = buildCssCookieblocker; |