Skip to content

Commit 3c69a10

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 a9f0e53 commit 3c69a10

File tree

13 files changed

+1108
-4781
lines changed

13 files changed

+1108
-4781
lines changed

CHANGELOG.md

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

2222
### 🐛 Bug Fixes
2323

packages/osd-interpreter/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
"del": "^6.1.1",
2828
"getopts": "^2.2.5",
2929
"pegjs": "0.10.0",
30-
"sass-loader": "^10.4.1",
30+
"sass-loader": "npm:@amoo-miki/sass-loader@10.4.1-node-sass-9.0.0-libsass-3.6.5",
3131
"style-loader": "^1.1.3",
3232
"supports-color": "^7.0.0",
3333
"url-loader": "^2.2.0",

packages/osd-optimizer/package.json

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
"jest-diff": "^27.5.1",
2929
"js-yaml": "^3.14.0",
3030
"json-stable-stringify": "^1.0.1",
31-
"node-sass": "^8.0.0",
3231
"lmdb": "^2.8.0",
3332
"normalize-path": "^3.0.0",
3433
"pirates": "^4.0.1",
@@ -49,12 +48,14 @@
4948
"@types/watchpack": "^1.1.6",
5049
"@types/webpack": "^4.41.31",
5150
"babel-loader": "^8.2.3",
51+
"comment-stripper": "^0.0.4",
5252
"css-loader": "^5.2.7",
5353
"file-loader": "^6.2.0",
5454
"loader-utils": "^2.0.4",
55+
"node-sass": "npm:@amoo-miki/node-sass@9.0.0-libsass-3.6.5",
5556
"postcss-loader": "^4.2.0",
5657
"raw-loader": "^4.0.2",
57-
"sass-loader": "^10.4.1",
58+
"sass-loader": "npm:@amoo-miki/sass-loader@10.4.1-node-sass-9.0.0-libsass-3.6.5",
5859
"style-loader": "^1.1.3",
5960
"url-loader": "^2.2.0",
6061
"val-loader": "^2.1.2",

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)