Skip to content

Commit

Permalink
Reduce the amount of comments in compiled CSS (#4648) (#4681)
Browse files Browse the repository at this point in the history
(cherry picked from commit 4bc1f55)

Signed-off-by: Miki <miki@amazon.com>
  • Loading branch information
AMoo-Miki authored Aug 14, 2023
1 parent ceaaeb1 commit e0e6617
Show file tree
Hide file tree
Showing 12 changed files with 1,189 additions and 4,955 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- [Saved Object Service] Add Repository Factory Provider ([#4149](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4149))
- Enable plugins to augment visualizations with additional data and context ([#4361](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4361))
- New management overview page and rename stack management to dashboard management ([#4287](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4287))

- Reduce the amount of comments in compiled CSS ([#4648](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4648))

### 🐛 Bug Fixes

Expand Down
1 change: 1 addition & 0 deletions packages/osd-optimizer/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"@types/watchpack": "^1.1.6",
"@types/webpack": "^4.41.31",
"babel-loader": "^8.2.3",
"comment-stripper": "^0.0.4",
"css-loader": "^5.2.7",
"file-loader": "^6.2.0",
"loader-utils": "^2.0.4",
Expand Down
12 changes: 12 additions & 0 deletions packages/osd-optimizer/src/worker/webpack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,12 @@ export function getWebpackConfig(bundle: Bundle, bundleRefs: BundleRefs, worker:
sourceMap: !worker.dist,
},
},
{
loader: 'comment-stripper',
options: {
language: 'css',
},
},
],
},
{
Expand Down Expand Up @@ -164,6 +170,12 @@ export function getWebpackConfig(bundle: Bundle, bundleRefs: BundleRefs, worker:
},
},
},
{
loader: 'comment-stripper',
options: {
language: 'css',
},
},
{
loader: 'sass-loader',
options: {
Expand Down
6 changes: 5 additions & 1 deletion packages/osd-ui-framework/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
* under the License.
*/

const { strip } = require('comment-stripper');
const sass = require('node-sass');
const postcss = require('postcss');
const postcssConfig = require('@osd/optimizer/postcss.config.js');
Expand Down Expand Up @@ -91,7 +92,10 @@ module.exports = function (grunt) {
}

postcss([postcssConfig])
.process(result.css, { from: src, to: dest })
.process(strip(result.css.toString('utf8'), { language: 'css' }), {
from: src,
to: dest,
})
.then((result) => {
grunt.file.write(dest, result.css);

Expand Down
Loading

0 comments on commit e0e6617

Please sign in to comment.