Skip to content

Commit

Permalink
Merge pull request #6 from closemarketing/5-make-minify-files
Browse files Browse the repository at this point in the history
compress files
  • Loading branch information
davidperezgar authored Sep 30, 2024
2 parents a59ccee + d50aca7 commit fe76918
Show file tree
Hide file tree
Showing 11 changed files with 2,381 additions and 6 deletions.
6 changes: 5 additions & 1 deletion .distignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@ circle.yml
.github
composer.json
composer.lock
.wordpress-org
.wordpress-org
node_modules/
gulpfile.js
package.json
package-lock.json
18 changes: 18 additions & 0 deletions gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const gulp = require('gulp');
const minify = require('gulp-minify');
const cleanCSS = require('gulp-clean-css');

gulp.task('compress', function() {
gulp.src(['./includes/animations/*.js'])
.pipe(minify())
.pipe(gulp.dest('./includes/dist'));
gulp.src(['./includes/carousel/*.js'])
.pipe(minify())
.pipe(gulp.dest('./includes/dist'));
gulp.src('./includes/animations/*.css')
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest('./includes/dist'));
gulp.src('./includes/carousel/*.css')
.pipe(cleanCSS({compatibility: 'ie8'}))
.pipe(gulp.dest('./includes/dist'));
});
6 changes: 4 additions & 2 deletions includes/animations/frontblocks-animations.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@
* @return void
*/
function frbl_theme_scripts_animations() {
$dist_dir = WP_DEBUG ? 'animations/' : 'dist/';

wp_enqueue_style(
'frontblocks-animations',
FRBL_PLUGIN_URL . 'includes/animations/frontblocks-animations.css',
FRBL_PLUGIN_URL . 'includes/' . $dist_dir . 'frontblocks-animations.css',
array(),
FRBL_VERSION
);

wp_enqueue_script(
'frontblocks-animations-custom',
FRBL_PLUGIN_URL . 'includes/animations/frontblocks-animations.js',
FRBL_PLUGIN_URL . 'includes/' . $dist_dir . 'frontblocks-animations.js',
array(),
FRBL_VERSION,
true
Expand Down
7 changes: 4 additions & 3 deletions includes/carousel/frontblocks-carousel.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,24 +17,25 @@
* @return void
*/
function frbl_theme_scripts() {
$dist_dir = WP_DEBUG ? 'carousel/' : 'dist/';
wp_enqueue_style(
'frontblocks-carousel',
FRBL_PLUGIN_URL . 'includes/carousel/frontblocks-carousel.css',
FRBL_PLUGIN_URL . 'includes/' . $dist_dir . 'frontblocks-carousel.css',
array(),
FRBL_VERSION
);

wp_enqueue_script(
'frontblocks-carousel',
FRBL_PLUGIN_URL . 'includes/carousel/glide.min.js',
FRBL_PLUGIN_URL . 'includes/dist/glide.min.js',
array(),
FRBL_VERSION,
true
);

wp_enqueue_script(
'frontblocks-carousel-custom',
FRBL_PLUGIN_URL . 'includes/carousel/frontblocks-carousel.js',
FRBL_PLUGIN_URL . 'includes/' . $dist_dir . 'frontblocks-carousel.js',
array( 'frontblocks-carousel' ),
FRBL_VERSION,
true
Expand Down
7 changes: 7 additions & 0 deletions includes/dist/frontblocks-animations.css

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions includes/dist/frontblocks-animations.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions includes/dist/frontblocks-carousel.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions includes/dist/frontblocks-carousel.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
Loading

0 comments on commit fe76918

Please sign in to comment.