Skip to content

Commit

Permalink
Reduce the amount of comments in compiled CSS
Browse files Browse the repository at this point in the history
Signed-off-by: Miki <miki@amazon.com>
  • Loading branch information
AMoo-Miki committed Aug 3, 2023
1 parent bf6e887 commit c2beb4b
Show file tree
Hide file tree
Showing 12 changed files with 1,097 additions and 4,770 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ Inspired from [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- Enable theme-switching via Advanced Settings to preview the Next theme ([#4475](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4475))
- Optimize `augment-vis` saved obj searching by adding arg to saved obj client ([#4595](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4595))
- Add resource ID filtering in fetch `augment-vis` obj queries ([#4608](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4608))
- Reduce the amount of comments in compiled CSS ([#4648](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4648))
- [Discover] Update styles to compatible with OUI `next` theme ([#4644](https://github.com/opensearch-project/OpenSearch-Dashboards/pull/4644))

### 🐛 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 c2beb4b

Please sign in to comment.