diff --git a/.gitattributes b/.gitattributes index 0183215..7be32ee 100644 --- a/.gitattributes +++ b/.gitattributes @@ -20,7 +20,7 @@ /composer.lock export-ignore /CONTRIBUTING.md export-ignore /gulpfile.mjs export-ignore -/package-lock.json export-ignore +#/package-lock.json export-ignore /package.json export-ignore /phpcs.xml.dist export-ignore /phpunit.xml.dist export-ignore diff --git a/.github/workflows/composer-npm-diff.yml b/.github/workflows/composer-npm-diff.yml index c43fe8f..b5ca48f 100644 --- a/.github/workflows/composer-npm-diff.yml +++ b/.github/workflows/composer-npm-diff.yml @@ -3,7 +3,7 @@ on: pull_request: paths: - 'composer.lock' - - 'package-lock.json' + # - 'package-lock.json' permissions: contents: write pull-requests: write @@ -27,16 +27,20 @@ jobs: Composer Changes ${{ steps.composer_diff.outputs.composer_diff }} - npm-diff: - name: NPM Lockfile Diff - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: NPM Lockfile Changes - uses: codepunkt/npm-lockfile-changes@main - with: - token: ${{ github.token }} - updateComment: true + # Removing because the workflow fails for some unknown reason, see https://github.com/pantheon-systems/pantheon-advanced-page-cache/actions/runs/9228002744/job/25391128483 + # There's no support for this action, so we might need to build something new. + # npm-diff: + # name: NPM Lockfile Diff + # runs-on: ubuntu-latest + # continue-on-error: true + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 + # - name: Compile NPM packages + # run: npm ci + # - name: NPM Lockfile Changes + # uses: codepunkt/npm-lockfile-changes@main + # with: + # token: ${{ github.token }} diff --git a/gulpfile.mjs b/gulpfile.mjs index a1775b9..e1fe4ec 100644 --- a/gulpfile.mjs +++ b/gulpfile.mjs @@ -3,14 +3,17 @@ import gulp from 'gulp'; import csso from 'gulp-csso'; import * as sassCompiler from 'sass'; import gulpSass from 'gulp-sass'; +import rename from 'gulp-rename' const sass = gulpSass(sassCompiler); gulp.task('styles', () => { return gulp.src('assets/sass/styles.scss') // Only compile the main file .pipe(sass().on('error', sass.logError)) // Compile SASS to CSS + .pipe(gulp.dest('assets/css')) // Save unminified CSS .pipe(csso()) // Minify CSS - .pipe(gulp.dest('assets/css')); // Save the CSS file + .pipe(rename({suffix: '.min'})) // Rename to styles.min.css + .pipe(gulp.dest('assets/css')); // Save the minified CSS file }); gulp.task('clean', () => { diff --git a/inc/admin-interface.php b/inc/admin-interface.php index 580cdac..a95e10f 100644 --- a/inc/admin-interface.php +++ b/inc/admin-interface.php @@ -59,7 +59,9 @@ function enqueue_admin_assets() { // If WP_DEBUG is true, append a timestamp to the end of the path so we get a fresh copy of the css. $debug = defined( 'WP_DEBUG' ) && WP_DEBUG ? '-' . time() : ''; - wp_enqueue_style( 'papc-admin', plugin_dir_url( __DIR__ ) . 'assets/css/styles.css', [], '2.0.0' . $debug ); + // Use minified css unless SCRIPT_DEBUG is true. + $min = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min'; + wp_enqueue_style( 'papc-admin', plugin_dir_url( __DIR__ ) . "assets/css/styles$min.css", [], '2.0.0' . $debug ); } /** diff --git a/package-lock.json b/package-lock.json index b23a51c..401fb61 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,6 +14,7 @@ "gulp-autoprefixer": "^9.0.0", "gulp-concat": "^2.6.1", "gulp-csso": "^4.0.1", + "gulp-rename": "^2.0.0", "gulp-sass": "^5.1.0", "node-sass": "^9.0.0", "sass": "^1.77.1" @@ -1885,6 +1886,15 @@ "url": "https://github.com/chalk/chalk?sponsor=1" } }, + "node_modules/gulp-rename": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/gulp-rename/-/gulp-rename-2.0.0.tgz", + "integrity": "sha512-97Vba4KBzbYmR5VBs9mWmK+HwIf5mj+/zioxfZhOKeXtx5ZjBk57KFlePf5nxq9QsTtFl0ejnHE3zTC9MHXqyQ==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/gulp-sass": { "version": "5.1.0", "resolved": "https://registry.npmjs.org/gulp-sass/-/gulp-sass-5.1.0.tgz", diff --git a/package.json b/package.json index abd411e..8afd018 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "gulp-autoprefixer": "^9.0.0", "gulp-concat": "^2.6.1", "gulp-csso": "^4.0.1", + "gulp-rename": "^2.0.0", "gulp-sass": "^5.1.0", "node-sass": "^9.0.0", "sass": "^1.77.1"