Skip to content

Commit

Permalink
Add Prettier for CSS and JS formatting in CI workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
paskal committed Nov 1, 2024
1 parent 58db98a commit 2cc8b50
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions .github/workflows/ci-build-site.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ jobs:
# Copy the generated manifest.json from the new build
cp ${{ steps.set-dirs.outputs.new_dir }}/hugo/data/manifest.json ${{ steps.set-dirs.outputs.new_dir }}/manifest.json
- name: Install Prettier
run: npm install -g prettier

- name: Prettify CSS and JS in public directories
run: |
# Format all CSS and JS files in both old and new public directories for easier comparison
sudo prettier --write "${{ steps.set-dirs.outputs.old_dir }}/public/**/*.css"
sudo prettier --write "${{ steps.set-dirs.outputs.old_dir }}/public/**/*.js"
sudo prettier --write "${{ steps.set-dirs.outputs.new_dir }}/public/**/*.css"
sudo prettier --write "${{ steps.set-dirs.outputs.new_dir }}/public/**/*.js"
- name: Remove itunes:subtitle from RSS feeds before comparison
run: |
sed -i 's#<itunes:subtitle>.*</itunes:subtitle>##' ${{ steps.set-dirs.outputs.old_dir }}/public/podcast-archives-short.rss
Expand Down
4 changes: 2 additions & 2 deletions hugo/webpack.mix.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ mix
['app', 'vendor'].forEach((style) => {
mix
.sass(`src/scss/${style}.scss`, '.')
.options({ postCss: [require('cssnano')] }); // Conditionally include cssnano
.options({ postCss: shouldMinify ? [require('cssnano')] : [] }); // Conditionally include cssnano
mix
.sass(`src/scss/${style}-dark.scss`, '.')
.options({ postCss: [require('cssnano')] }); // Conditionally include cssnano
.options({ postCss: shouldMinify ? [require('cssnano')] : [] }); // Conditionally include cssnano
});

mix.webpackConfig({
Expand Down

0 comments on commit 2cc8b50

Please sign in to comment.