-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
New compilation process #24
base: feature/modernization
Are you sure you want to change the base?
New compilation process #24
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving some comments here
module.exports = { | ||
...defaultConfig, | ||
entry: getWebpackEntryPoints(), | ||
output: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we producing both minified and unminified versions in parallel here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about the parallel term, but for JS files we are producing minified and unminifiied. For CSS files we are only producing minifiied versions.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What i meant was to run these in the same build process (not having to run it twice)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, normal/min JS and min CSS are being produced within the same npm run build 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msaggiorato, also producing minifiied and not versions of the css files. Only drawback is that i could not find a way to achieve that without overwritting all the webpack.module.rules from the original wordpress-scripts webpack.confiig.js file.
Of course, ive brought all the needed rules in our webpack.config.js file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@msaggiorato i think this comment can be resolved. Your commits are fixing this 😄
@msaggiorato looks really good! Ive added a postbuild command in order to produce a zip ready to be uploaded. |
plugin-name/package.json
Outdated
"makepot": "wpi18n makepot --domain-path=\"i18n/languages\" --pot-file=\"plugin-name.pot\" --type=\"plugin\" --main-file=\"plugin-name.php\" --exclude=\"node_modules,tests,docs,docker,vendor\"", | ||
"watch": "webpack --mode=none --watch", | ||
"prearchive": "rm -rf $npm_package_config_wp_org_slug.zip vendor/ node_modules/ && composer install --no-dev --optimize-autoloader && npm install --only=prod --ignore-scripts", | ||
"archive": "composer archive --file=$npm_package_config_wp_org_slug --format=zip", | ||
"archive": "cross-var rm -rf $npm_package_config_wp_org_slug.zip vendor/ node_modules/ && composer install --no-dev --optimize-autoloader && npm install --only=prod --ignore-scripts && composer archive --file=$npm_package_config_wp_org_slug --dir=$npm_package_config_wp_org_slug --format=zip", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rm -rf still is dependant on a unix based shell right?
plugin-name/package.json
Outdated
"postbuild:assets": "rm -rf assets/css/**/*.php assets/css/**/*.js", | ||
"build": "npm run makepot && npm run build:assets && npm run archive" | ||
"build": "npm run makepot && npm run build:assets && npm run archive", | ||
"postbuild": "cross-var unzip -q $npm_package_config_wp_org_slug/$npm_package_config_wp_org_slug.zip -d $npm_package_config_wp_org_slug && rm $npm_package_config_wp_org_slug/$npm_package_config_wp_org_slug.zip && zip -q -r $npm_package_config_wp_org_slug.zip $npm_package_config_wp_org_slug -qq && rm -rf $npm_package_config_wp_org_slug" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unzip itself is still dependant on a unix shell right?
], | ||
}, | ||
plugins: [ | ||
new RemoveEmptyScriptsPlugin(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this an indenting error?
Changed assets directory structure from assets to src. Also included directories for images and fonts. All of these will be moved into a directory named assets, keeping their directory structure during npm run build.
Fixed hook plugin_name_loaded which was being called twice.
Fiixed src of the admin assets.
Pending:
To test the changes
pre
orpost