ec8bd31365
* Update webpack config to use file content hash for chunks and generate asset php for styles * Use StyleAssetPlugin to generate style.asset.php * Remove unneed ?ver=<version> code * Use file hash from asset file when SCRIPT_DEBUG is off - Use file hash to load scripts/styles ?ver=<file hash> - Add register_style() method to WC_Admin_Assets * Load payment method promotions in admin_enqueue_scripts * Add changefile(s) from automation for the following project(s): @woocommerce/product-editor, woocommerce * Add json2php * Update doc * Update pnpm-lock.yaml * Fix add_print_shipping_label_script * Add a comment to style-asset-plugin.js * Change register_style to use WC_ADMIN_DIST_CSS_FOLDER * Reset the outputNormal object to avoid duplicate files * Fix type error --------- Co-authored-by: github-actions <github-actions@github.com> |
||
---|---|---|
.. | ||
abstracts | ||
changelog | ||
.eslintrc.js | ||
.npmrc | ||
README.md | ||
index.js | ||
package.json | ||
style-asset-plugin.js |
README.md
Style Build Helper
This is a partial Webpack config for building WooCommece component styles using base styles from Gutenberg. It is used to replace the bin/packages/build.js
script.
Usage
Create a webpack.config.js
in your package root that defines the entry
and output
, making use of the rules
and plugins
from @woocommerce/internal-style-build
.
Note: The entry
should be named 'build-style'
so the CSS will get picked up by the main client/
application's CopyWebpackPlugin
config.
// packages/<package-name>/webpack.config.js
import { webpackConfig } from '@woocommerce/internal-style-build';
module.exports = {
mode: process.env.NODE_ENV || 'development',
entry: {
'build-style': __dirname + '/src/style.scss',
},
output: {
path: __dirname,
},
module: {
rules: webpackConfig.rules,
},
plugins: webpackConfig.plugins,
};