Skip to content

Commit b91efab

Browse files
committed
Reduce the amount of comments in compiled CSS (opensearch-project#4648)
Signed-off-by: Miki <miki@amazon.com> (cherry picked from commit 4bc1f55) Signed-off-by: Miki <miki@amazon.com>
1 parent ceaaeb1 commit b91efab

File tree

12 files changed

+1097
-4771
lines changed

12 files changed

+1097
-4771
lines changed

CHANGELOG.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
1818
- [Saved Object Service] Add Repository Factory Provider ([#4149](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4149))
1919
- Enable plugins to augment visualizations with additional data and context ([#4361](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4361))
2020
- New management overview page and rename stack management to dashboard management ([#4287](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4287))
21-
21+
- Reduce the amount of comments in compiled CSS ([#4648](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4648))
2222

2323
### 🐛 Bug Fixes
2424

packages/osd-optimizer/package.json

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

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

+12
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,12 @@ export function getWebpackConfig(bundle: Bundle, bundleRefs: BundleRefs, worker:
164170
},
165171
},
166172
},
173+
{
174+
loader: 'comment-stripper',
175+
options: {
176+
language: 'css',
177+
},
178+
},
167179
{
168180
loader: 'sass-loader',
169181
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)