Skip to content

Commit

Permalink
fix: replace cssnano with gulp-clean-css
Browse files Browse the repository at this point in the history
  • Loading branch information
luangjokaj committed Nov 2, 2024
1 parent 795f9ae commit cb9ed34
Show file tree
Hide file tree
Showing 8 changed files with 1,472 additions and 1,649 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- 📦 NEW: Updated default theme, removed php in favor of HTML templates with block markup, using modern block [themes](https://developer.wordpress.org/block-editor/explanations/architecture/key-concepts/).
- 📦 NEW: Added code formatters. PHP CS Fixer for PHP code style consistency. Prettier for HTML, JavaScript and CSS.
- 🐛 FIX: Watch tasks, now they work as expected. Deleted files will be automatically removed from the build folder as expected. Also fixed an issue where the watch task would not work for new images or fonts.
- 🐛 FIX: Replace `cssnano` with `gulp-clean-css`.

**v0.4.0**

Expand Down Expand Up @@ -402,4 +403,3 @@

- 🐛 FIX: Bugfixes.
- 📦 NEW: Watch and store new content in `wp-content/uploads`.

57 changes: 57 additions & 0 deletions bump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/bin/bash

# Check if version argument is provided
if [ -z "$1" ]; then
echo "Please provide a version number (e.g. ./bump.sh 0.5.1)"
exit 1
fi

NEW_VERSION=$1

# Function to update version in a file (only first occurrence)
update_version() {
local file=$1
echo "Updating $file..."
# Using awk to replace only the first occurrence of version
awk -v new_ver="$NEW_VERSION" '
!found && /"version":/ {
sub(/"version": *"[^"]*"/, "\"version\": \"" new_ver "\"")
found=1
}
{print}
' "$file" > temp.json && mv temp.json "$file"
}

# Update version in each package.json
update_version "package.json"
update_version "installer/package-lock.json"
update_version "installer/package.json"
update_version "installer/package-lock.json"

echo "✅ Successfully updated version to $NEW_VERSION in all package.json files"

# Optional: Git commands to commit the changes
read -p "Do you want to commit these changes? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
git add package.json installer/package.json
git commit -m "chore: bump version to $NEW_VERSION"
echo "✅ Changes committed"

read -p "Do you want to create a git tag? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
git tag -a "v$NEW_VERSION" -m "Version $NEW_VERSION"
echo "✅ Tag v$NEW_VERSION created"

read -p "Do you want to push the tag? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]
then
git push origin "v$NEW_VERSION"
echo "✅ Tag pushed to remote"
fi
fi
fi
12 changes: 2 additions & 10 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import postcssPresetEnv from "postcss-preset-env";
import sourcemaps from "gulp-sourcemaps";
import uglify from "gulp-uglify";
import zip from "gulp-vinyl-zip";
import cssnano from "cssnano";
import cleanCSS from "gulp-clean-css";

const { series, dest, src, watch } = pkg;

Expand Down Expand Up @@ -50,14 +50,6 @@ const pluginsListProd = [
}),
postCSSMixins,
autoprefixer,
cssnano({
preset: [
"default",
{
discardComments: false,
},
],
}),
];

/* -------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -295,6 +287,7 @@ function stylesProd() {
return src("./src/assets/css/style.css")
.pipe(plumber({ errorHandler: onError }))
.pipe(postcss(pluginsListProd))
.pipe(cleanCSS())
.pipe(dest("./dist/themes/" + themeName));
}

Expand Down Expand Up @@ -399,4 +392,3 @@ const thankYou = "Thank you for using " + wpFy + wpFyUrl;
/* -------------------------------------------------------------------------------------------------
End of all Tasks
-------------------------------------------------------------------------------------------------- */

Loading

0 comments on commit cb9ed34

Please sign in to comment.