[wp-trac] [WordPress Trac] #53719: `grunt clean:css` does not clean the `css/dist` folder

WordPress Trac noreply at wordpress.org
Wed Sep 1 03:49:05 UTC 2021


#53719: `grunt clean:css` does not clean the `css/dist` folder
------------------------------+----------------------------
 Reporter:  desrosj           |       Owner:  peterwilsoncc
     Type:  defect (bug)      |      Status:  reopened
 Priority:  highest omg bbq   |   Milestone:  5.8.1
Component:  Build/Test Tools  |     Version:
 Severity:  normal            |  Resolution:
 Keywords:  has-patch         |     Focuses:
------------------------------+----------------------------

Comment (by netweb):

 Replying to [comment:5 peterwilsoncc]:
 > Reopening as this appears to have an order of operations issue.
 >
 > `build:webpack-assets` places a bunch of CSS files in `css/dist`
 > `build:css` then runs `clean:css` which deletes the newly minted files.
 >

 I think so, looking at the Grunt task build order, a quick summary:

 After `webpack:*` tasks are run, the `clean:css` task is run again

 {{{
 #!bash
 ❯ npm run build

 > WordPress at 5.9.0 build /Users/netweb/Code/wordpress-develop
 > grunt build

 package.json has not been modified.
 Running "build" task

 Running "clean:files" (clean) task
 >> 3227 paths cleaned.

 ...

 Running "clean:webpack-assets" (clean) task
 >> 0 paths cleaned.

 Running "webpack:prod" (webpack) task
 Hash: 690f241987760f4a831e2fa831a8185fd37e781d093304c4f1ae113230c0
 Version: webpack 4.43.0

 Running "webpack:dev" (webpack) task
 Hash: 727e0b23022f0575688b2fa831a8185fd37e781d77b719b272f77a0b7ef8
 Version: webpack 4.43.0

 Running "clean:css" (clean) task
 >> 135 paths cleaned.

 ...

 Done.
 }}}

 Moving the clean `WORKING_DIR + 'wp-includes/css/dist/'` from `clean:css`
 to `clean:webpack-assets` might be the fix:

 {{{
 #!diff
 diff --git Gruntfile.js Gruntfile.js
 index d273eac5e6..369079dc1d 100644
 --- Gruntfile.js
 +++ Gruntfile.js
 @@ -115,7 +115,6 @@ module.exports = function(grunt) {
                                 WORKING_DIR + 'wp-admin/css/*-rtl*.css',
                                 WORKING_DIR + 'wp-includes/css/*.min.css',
                                 WORKING_DIR + 'wp-
 includes/css/*-rtl*.css',
 -                               WORKING_DIR + 'wp-includes/css/dist/',
                                 WORKING_DIR + 'wp-
 admin/css/colors/**/*.css'
                         ],
                         js: [
 @@ -124,6 +123,7 @@ module.exports = function(grunt) {
                         ],
                         'webpack-assets': [
                                 WORKING_DIR + 'wp-includes/assets/*',
 +                               WORKING_DIR + 'wp-includes/css/dist/',
                                 '!' + WORKING_DIR + 'wp-includes/assets
 /script-loader-packages.php'
                         ],
                         dynamic: {

 }}}

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/53719#comment:8>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list