Skip to content

Commit 6a5f99b

Browse files
committed
Reduce the amount of comments in compiled CSS
Signed-off-by: Miki <miki@amazon.com>
1 parent a52e95c commit 6a5f99b

File tree

12 files changed

+1083
-4770
lines changed

12 files changed

+1083
-4770
lines changed

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
2020
- Enable theme-switching via Advanced Settings to preview the Next theme ([#4475](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4475))
2121
- Optimize `augment-vis` saved obj searching by adding arg to saved obj client ([#4595](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4595))
2222
- Add resource ID filtering in fetch `augment-vis` obj queries ([#4608](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4608))
23+
- Reduce the amount of comments in compiled CSS ([#4648](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4648))
2324
- [Discover] Update styles to compatible with OUI `next` theme ([#4644](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4644))
2425

2526
### 🐛 Bug Fixes

packages/osd-optimizer/package.json

+1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@
4949
"@types/watchpack": "^1.1.6",
5050
"@types/webpack": "^4.41.31",
5151
"babel-loader": "^8.2.3",
52+
"comment-stripper": "^0.0.4",
5253
"css-loader": "^5.2.7",
5354
"file-loader": "^6.2.0",
5455
"loader-utils": "^2.0.4",

packages/osd-optimizer/src/worker/webpack.config.ts

+7
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ export function getWebpackConfig(bundle: Bundle, bundleRefs: BundleRefs, worker:
137137
sourceMap: !worker.dist,
138138
},
139139
},
140+
{
141+
loader: 'comment-stripper',
142+
options: {
143+
language: 'css',
144+
},
145+
},
140146
],
141147
},
142148
{
@@ -164,6 +170,7 @@ export function getWebpackConfig(bundle: Bundle, bundleRefs: BundleRefs, worker:
164170
},
165171
},
166172
},
173+
'comment-stripper',
167174
{
168175
loader: 'sass-loader',
169176
options: {

packages/osd-ui-framework/Gruntfile.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
* under the License.
2929
*/
3030

31+
const { strip } = require('comment-stripper');
3132
const sass = require('node-sass');
3233
const postcss = require('postcss');
3334
const postcssConfig = require('@osd/optimizer/postcss.config.js');
@@ -91,7 +92,10 @@ module.exports = function (grunt) {
9192
}
9293

9394
postcss([postcssConfig])
94-
.process(result.css, { from: src, to: dest })
95+
.process(strip(result.css.toString('utf8'), { language: 'css' }), {
96+
from: src,
97+
to: dest,
98+
})
9599
.then((result) => {
96100
grunt.file.write(dest, result.css);
97101

0 commit comments

Comments
 (0)