Skip to content

Commit

Permalink
chore(masthead-alpha-v2): get latest from alpha dev into alpha releas…
Browse files Browse the repository at this point in the history
…e branch (#11517)

This gets the HTML template minifications cherry-picked in #11504 into the release branch.
  • Loading branch information
jkaeser authored Feb 13, 2024
1 parent 2c25f09 commit 24486f7
Show file tree
Hide file tree
Showing 15 changed files with 130 additions and 79 deletions.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -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,
],
})
Expand Down
1 change: 1 addition & 0 deletions packages/carbon-web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
41 changes: 17 additions & 24 deletions packages/carbon-web-components/tools/get-rollup-config.js
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -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');
Expand Down Expand Up @@ -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',
Expand All @@ -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({
Expand Down
1 change: 1 addition & 0 deletions packages/web-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
Original file line number Diff line number Diff line change
@@ -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.
Expand Down Expand Up @@ -858,9 +858,7 @@ class DDSTableOfContents extends HostListenerMixin(
<div class="${prefix}--tableofcontents__desktop-container">
<div
class="${prefix}--tableofcontents__desktop"
style="${pageIsRTL
? 'right'
: 'left'}: -${currentScrollPosition}px">
style="inset-inline-start: -${currentScrollPosition}px">
${pageIsRTL
? html` <div class="${prefix}--sub-content-right"></div> `
: html` <div class="${prefix}--sub-content-left"></div> `}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
<div class="bx--tableofcontents__desktop-container">
<div
class="bx--tableofcontents__desktop"
style="left: -0px"
style="inset-inline-start: -0px"
>
<div class="bx--sub-content-left">
</div>
Expand Down Expand Up @@ -84,7 +84,7 @@
<div class="bx--tableofcontents__desktop-container">
<div
class="bx--tableofcontents__desktop"
style="left: -0px"
style="inset-inline-start: -0px"
>
<div class="bx--sub-content-left">
</div>
Expand Down Expand Up @@ -133,7 +133,7 @@
<div class="bx--tableofcontents__desktop-container">
<div
class="bx--tableofcontents__desktop"
style="left: -0px"
style="inset-inline-start: -0px"
>
<div class="bx--sub-content-left">
</div>
Expand Down
41 changes: 17 additions & 24 deletions packages/web-components/tools/get-rollup-config.js
Original file line number Diff line number Diff line change
@@ -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.
Expand All @@ -24,6 +24,8 @@ const replace = require('@rollup/plugin-replace');
const { terser } = require('rollup-plugin-terser');
const multiInput = require('rollup-plugin-multi-input').default;
const injectProcessEnv = require('rollup-plugin-inject-process-env');
const minifyHTMLLiterals =
require('rollup-plugin-minify-html-literals').default;

const ibmdotcomIcon = require('./rollup-plugin-ibmdotcom-icon');
const litSCSS = require('./rollup-plugin-lit-scss');
Expand Down Expand Up @@ -164,6 +166,17 @@ function getRollupConfig({
include: [/node_modules/],
sourceMap: true,
}),
minifyHTMLLiterals({
failOnError: true,
options: {
minifyOptions: {
caseSensitive: true,
collapseInlineTagWhitespace: true,
collapseWhitespace: true,
removeComments: true,
},
},
}),
ibmdotcomIcon(),
injectProcessEnv(
{
Expand All @@ -187,29 +200,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',
],
}),
// We are using `carbon-web-components` code merely as the source of inheritance,
Expand Down
Loading

0 comments on commit 24486f7

Please sign in to comment.