Skip to content

Commit cb9ed34

Browse files
committed
fix: replace cssnano with gulp-clean-css
1 parent 795f9ae commit cb9ed34

File tree

8 files changed

+1472
-1649
lines changed

8 files changed

+1472
-1649
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- 📦 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/).
66
- 📦 NEW: Added code formatters. PHP CS Fixer for PHP code style consistency. Prettier for HTML, JavaScript and CSS.
77
- 🐛 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.
8+
- 🐛 FIX: Replace `cssnano` with `gulp-clean-css`.
89

910
**v0.4.0**
1011

@@ -402,4 +403,3 @@
402403

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

bump.sh

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
#!/bin/bash
2+
3+
# Check if version argument is provided
4+
if [ -z "$1" ]; then
5+
echo "Please provide a version number (e.g. ./bump.sh 0.5.1)"
6+
exit 1
7+
fi
8+
9+
NEW_VERSION=$1
10+
11+
# Function to update version in a file (only first occurrence)
12+
update_version() {
13+
local file=$1
14+
echo "Updating $file..."
15+
# Using awk to replace only the first occurrence of version
16+
awk -v new_ver="$NEW_VERSION" '
17+
!found && /"version":/ {
18+
sub(/"version": *"[^"]*"/, "\"version\": \"" new_ver "\"")
19+
found=1
20+
}
21+
{print}
22+
' "$file" > temp.json && mv temp.json "$file"
23+
}
24+
25+
# Update version in each package.json
26+
update_version "package.json"
27+
update_version "installer/package-lock.json"
28+
update_version "installer/package.json"
29+
update_version "installer/package-lock.json"
30+
31+
echo "✅ Successfully updated version to $NEW_VERSION in all package.json files"
32+
33+
# Optional: Git commands to commit the changes
34+
read -p "Do you want to commit these changes? (y/n) " -n 1 -r
35+
echo
36+
if [[ $REPLY =~ ^[Yy]$ ]]
37+
then
38+
git add package.json installer/package.json
39+
git commit -m "chore: bump version to $NEW_VERSION"
40+
echo "✅ Changes committed"
41+
42+
read -p "Do you want to create a git tag? (y/n) " -n 1 -r
43+
echo
44+
if [[ $REPLY =~ ^[Yy]$ ]]
45+
then
46+
git tag -a "v$NEW_VERSION" -m "Version $NEW_VERSION"
47+
echo "✅ Tag v$NEW_VERSION created"
48+
49+
read -p "Do you want to push the tag? (y/n) " -n 1 -r
50+
echo
51+
if [[ $REPLY =~ ^[Yy]$ ]]
52+
then
53+
git push origin "v$NEW_VERSION"
54+
echo "✅ Tag pushed to remote"
55+
fi
56+
fi
57+
fi

gulpfile.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import postcssPresetEnv from "postcss-preset-env";
1414
import sourcemaps from "gulp-sourcemaps";
1515
import uglify from "gulp-uglify";
1616
import zip from "gulp-vinyl-zip";
17-
import cssnano from "cssnano";
17+
import cleanCSS from "gulp-clean-css";
1818

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

@@ -50,14 +50,6 @@ const pluginsListProd = [
5050
}),
5151
postCSSMixins,
5252
autoprefixer,
53-
cssnano({
54-
preset: [
55-
"default",
56-
{
57-
discardComments: false,
58-
},
59-
],
60-
}),
6153
];
6254

6355
/* -------------------------------------------------------------------------------------------------
@@ -295,6 +287,7 @@ function stylesProd() {
295287
return src("./src/assets/css/style.css")
296288
.pipe(plumber({ errorHandler: onError }))
297289
.pipe(postcss(pluginsListProd))
290+
.pipe(cleanCSS())
298291
.pipe(dest("./dist/themes/" + themeName));
299292
}
300293

@@ -399,4 +392,3 @@ const thankYou = "Thank you for using " + wpFy + wpFyUrl;
399392
/* -------------------------------------------------------------------------------------------------
400393
End of all Tasks
401394
-------------------------------------------------------------------------------------------------- */
402-

0 commit comments

Comments
 (0)