diff --git a/.yarn/cache/@types-clean-css-npm-4.2.11-2b47418843-385337a881.zip b/.yarn/cache/@types-clean-css-npm-4.2.11-2b47418843-385337a881.zip new file mode 100644 index 00000000000..5ab239db018 Binary files /dev/null and b/.yarn/cache/@types-clean-css-npm-4.2.11-2b47418843-385337a881.zip differ diff --git a/.yarn/cache/@types-html-minifier-npm-3.5.3-48bb59db10-bad3bece7e.zip b/.yarn/cache/@types-html-minifier-npm-3.5.3-48bb59db10-bad3bece7e.zip new file mode 100644 index 00000000000..f422fc14219 Binary files /dev/null and b/.yarn/cache/@types-html-minifier-npm-3.5.3-48bb59db10-bad3bece7e.zip differ diff --git a/.yarn/cache/@types-relateurl-npm-0.2.33-e8ef0a6da2-a4b7876cc2.zip b/.yarn/cache/@types-relateurl-npm-0.2.33-e8ef0a6da2-a4b7876cc2.zip new file mode 100644 index 00000000000..e1bf54dc9e0 Binary files /dev/null and b/.yarn/cache/@types-relateurl-npm-0.2.33-e8ef0a6da2-a4b7876cc2.zip differ diff --git a/.yarn/cache/html-minifier-npm-4.0.0-2c414aaddf-a1a49ee78a.zip b/.yarn/cache/html-minifier-npm-4.0.0-2c414aaddf-a1a49ee78a.zip new file mode 100644 index 00000000000..395d645edfa Binary files /dev/null and b/.yarn/cache/html-minifier-npm-4.0.0-2c414aaddf-a1a49ee78a.zip differ diff --git a/.yarn/cache/minify-html-literals-npm-1.3.5-2818068cad-9f5b50055e.zip b/.yarn/cache/minify-html-literals-npm-1.3.5-2818068cad-9f5b50055e.zip new file mode 100644 index 00000000000..679fff6d7f1 Binary files /dev/null and b/.yarn/cache/minify-html-literals-npm-1.3.5-2818068cad-9f5b50055e.zip differ diff --git a/.yarn/cache/parse-literals-npm-1.2.1-2c41c00bff-8f1ad2ed47.zip b/.yarn/cache/parse-literals-npm-1.2.1-2c41c00bff-8f1ad2ed47.zip new file mode 100644 index 00000000000..d152fed0970 Binary files /dev/null and b/.yarn/cache/parse-literals-npm-1.2.1-2c41c00bff-8f1ad2ed47.zip differ diff --git a/.yarn/cache/rollup-plugin-minify-html-literals-npm-1.2.6-fbf338ecb6-07b9f321dc.zip b/.yarn/cache/rollup-plugin-minify-html-literals-npm-1.2.6-fbf338ecb6-07b9f321dc.zip new file mode 100644 index 00000000000..2f1beac5ca2 Binary files /dev/null and b/.yarn/cache/rollup-plugin-minify-html-literals-npm-1.2.6-fbf338ecb6-07b9f321dc.zip differ diff --git a/packages/carbon-web-components/gulp-tasks/build/modules/scripts.js b/packages/carbon-web-components/gulp-tasks/build/modules/scripts.js index 83e716f8725..4c800da5306 100644 --- a/packages/carbon-web-components/gulp-tasks/build/modules/scripts.js +++ b/packages/carbon-web-components/gulp-tasks/build/modules/scripts.js @@ -1,7 +1,7 @@ /** * @license * - * Copyright IBM Corp. 2020, 2022 + * Copyright IBM Corp. 2020, 2024 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. @@ -38,22 +38,6 @@ function scripts() { // `version` field ensures `@babel/plugin-transform-runtime` is applied to newer helpers like decorator plugins: [ ['@babel/plugin-transform-runtime', { useESModules: true, version: '7.8.0' }], - [ - 'template-html-minifier', - { - modules: { - 'lit-html': ['html'], - 'lit-element': ['html'], - }, - htmlMinifier: { - collapseWhitespace: true, - conservativeCollapse: true, - removeComments: true, - caseSensitive: true, - minifyCSS: true, - }, - }, - ], babelPluginResourceJSPaths, ], }) diff --git a/packages/carbon-web-components/package.json b/packages/carbon-web-components/package.json index 648cea5c11c..43191e0931b 100644 --- a/packages/carbon-web-components/package.json +++ b/packages/carbon-web-components/package.json @@ -192,6 +192,7 @@ "replace-ext": "^2.0.0", "resize-observer-polyfill": "^1.5.0", "rollup": "^2.55.1", + "rollup-plugin-minify-html-literals": "^1.2.6", "rollup-plugin-multi-input": "^1.3.1", "rtlcss": "^3.0.0", "sass": "~1.62.0", diff --git a/packages/carbon-web-components/tools/get-rollup-config.js b/packages/carbon-web-components/tools/get-rollup-config.js index f11c495a585..c81c889e130 100644 --- a/packages/carbon-web-components/tools/get-rollup-config.js +++ b/packages/carbon-web-components/tools/get-rollup-config.js @@ -1,7 +1,7 @@ /** * @license * - * Copyright IBM Corp. 2020, 2022 + * Copyright IBM Corp. 2020, 2024 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. @@ -20,6 +20,8 @@ const { nodeResolve } = require('@rollup/plugin-node-resolve'); const rtlcss = require('rtlcss'); const { promisify } = require('util'); const { terser } = require('rollup-plugin-terser'); +const minifyHTMLLiterals = + require('rollup-plugin-minify-html-literals').default; const carbonIcons = require('./rollup-plugin-icons'); const fixHostPseudo = require('./postcss-fix-host-pseudo'); @@ -129,6 +131,17 @@ function getRollupConfig({ include: [/node_modules/], sourceMap: true, }), + minifyHTMLLiterals({ + failOnError: true, + options: { + minifyOptions: { + caseSensitive: true, + collapseInlineTagWhitespace: true, + collapseWhitespace: true, + removeComments: true, + }, + }, + }), carbonIcons(), babel.babel({ babelHelpers: 'runtime', @@ -142,29 +155,9 @@ function getRollupConfig({ '@babel/plugin-proposal-decorators', { decoratorsBeforeExport: true }, ], - '@babel/plugin-proposal-nullish-coalescing-operator', - ['@babel/plugin-proposal-object-rest-spread', { useBuiltIns: true }], - '@babel/plugin-proposal-optional-chaining', - ...(mode === 'development' - ? [] - : [ - [ - 'template-html-minifier', - { - modules: { - 'lit-html': ['html'], - 'lit-element': ['html'], - }, - htmlMinifier: { - collapseWhitespace: true, - conservativeCollapse: true, - removeComments: true, - caseSensitive: true, - minifyCSS: true, - }, - }, - ], - ]), + '@babel/plugin-transform-nullish-coalescing-operator', + ['@babel/plugin-transform-object-rest-spread', { useBuiltIns: true }], + '@babel/plugin-transform-optional-chaining', ], }), litSCSS({ diff --git a/packages/web-components/package.json b/packages/web-components/package.json index 666a6d6f29c..0d8aa51d44b 100644 --- a/packages/web-components/package.json +++ b/packages/web-components/package.json @@ -221,6 +221,7 @@ "rollup": "^2.55.1", "rollup-plugin-analyzer": "^4.0.0", "rollup-plugin-inject-process-env": "^1.3.1", + "rollup-plugin-minify-html-literals": "^1.2.6", "rollup-plugin-multi-input": "^1.3.1", "rollup-plugin-sizes": "^1.0.4", "rtlcss": "^3.0.0", diff --git a/packages/web-components/src/components/table-of-contents/table-of-contents.ts b/packages/web-components/src/components/table-of-contents/table-of-contents.ts index 461f144f55d..4804360ba8a 100644 --- a/packages/web-components/src/components/table-of-contents/table-of-contents.ts +++ b/packages/web-components/src/components/table-of-contents/table-of-contents.ts @@ -1,7 +1,7 @@ /** * @license * - * Copyright IBM Corp. 2020, 2023 + * Copyright IBM Corp. 2020, 2024 * * This source code is licensed under the Apache-2.0 license found in the * LICENSE file in the root directory of this source tree. @@ -858,9 +858,7 @@ class DDSTableOfContents extends HostListenerMixin(