Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added code to check unused CSS Files #1880

Closed
wants to merge 12 commits into from
2 changes: 1 addition & 1 deletion _data/discuss/meshery.json

Large diffs are not rendered by default.

101 changes: 51 additions & 50 deletions catalog/6370ffcd-13a6-4a65-b426-30f1e63dc381/0.0.1/design.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: Hierarchical Parent Relationship
version: 0.0.9
version: 0.0.16
services:
Generic Node:
annotations: {}
apiVersion: core.meshery.io/v1alpha1
dependsOn: []
id: null
isAnnotation: null
isAnnotation: false
labels: {}
model: meshery-core
name: Generic Node
Expand Down Expand Up @@ -56,8 +56,8 @@ services:
svgComplete: ""
svgWhite: ui/public/static/img/meshmodels/meshery-core/white/genericnode-white.svg
position:
posX: 410
posY: 230
posX: 430
posY: 330
whiteboardData:
style:
backgroundOpacity: 0
Expand All @@ -70,7 +70,7 @@ services:
apiVersion: rbac.authorization.k8s.io/v1
dependsOn: []
id: null
isAnnotation: null
isAnnotation: false
labels: {}
model: kubernetes
name: cluster-role-qv
Expand Down Expand Up @@ -143,9 +143,9 @@ services:
annotations: {}
apiVersion: v1
dependsOn:
- default-cyhkj
- default-prubv
id: null
isAnnotation: null
isAnnotation: false
labels: {}
model: kubernetes
name: config-map-io
Expand Down Expand Up @@ -215,9 +215,9 @@ services:
annotations: {}
apiVersion: v1
dependsOn:
- default-aomif
- default-zaidv
id: null
isAnnotation: null
isAnnotation: false
labels: {}
model: kubernetes
name: config-map-ng
Expand Down Expand Up @@ -256,6 +256,7 @@ services:
logoURL: https://github.com/cncf/artwork/blob/master/projects/kubernetes/icon/white/kubernetes-icon-white.svg
model: kubernetes
modelDisplayName: Kubernetes
parentId: a45faf23-bb79-4de1-9177-4b5eb71783a6
primaryColor: '#326CE5'
published: true
secondaryColor: '#7aa1f0'
Expand All @@ -277,39 +278,46 @@ services:
z-index: 7
type: ConfigMap
version: v1.25.2
default-aomif:
default-prubv:
annotations: {}
apiVersion: v1
dependsOn: []
id: null
isAnnotation: null
isAnnotation: false
labels: {}
model: kubernetes
name: default
namespace: default
namespace: ""
settings: {}
traits:
meshmap:
edges: []
fieldRefData: {}
id: a45faf23-bb79-4de1-9177-4b5eb71783a6
id: 7716aff1-55d9-4641-96dd-e8d0075783f8
label: Namespace
meshmodel-data:
category:
metadata: null
name: Orchestration & Management
components: []
components: null
description: ""
displayName: Kubernetes
hostID: 00000000-0000-0000-0000-000000000000
id: d247c4d8-3c7f-5e48-8158-2fba74f1c41c
hostID: 26e64aa8-2d86-57bd-92b3-2a73160d27b4
id: a5d424b9-55b1-5767-a451-a250c4098685
metadata:
isAnnotation: false
svgColor: ui/public/static/img/meshmodels/kubernetes/color/kubernetes-color.svg
svgWhite: ui/public/static/img/meshmodels/kubernetes/white/kubernetes-white.svg
model:
version: v1.25.2
name: kubernetes
relationships: []
status: registered
version: v1.25.2
registrant:
hostname: artifacthub
relationships: null
schemaVersion: core.meshery.io/v1beta1
status: enabled
subCategory: ""
version: v1.0.0
meshmodel-metadata:
capabilities: |2-
{
Expand All @@ -331,69 +339,60 @@ services:
model: kubernetes
modelDisplayName: Kubernetes
primaryColor: '#326CE5'
published: true
secondaryColor: '#7aa1f0'
shape: rectangle
shapePolygonPoints: ""
status: enabled
styleOverrides:
background-image: none
background-opacity: 0.5
border-style: dashed
border-width: 2
z-index: 5
z-index: 7
styles: '{"background-image":"none","border-width":2,"border-style":"dashed","background-opacity":0.5}'
subCategory: ""
svgColor: ui/public/static/img/meshmodels/kubernetes/color/namespace-color.svg
svgComplete: ui/public/static/img/meshmodels/kubernetes/complete/namespace-complete.svg
svgWhite: ui/public/static/img/meshmodels/kubernetes/white/namespace-white.svg
position:
posX: 646
posY: 399
whiteboardData:
style:
z-index: 5
posX: 470
posY: 459
whiteboardData: {}
type: Namespace
version: v1.25.2
default-cyhkj:
default-zaidv:
annotations: {}
apiVersion: v1
dependsOn: []
id: null
isAnnotation: null
isAnnotation: false
labels: {}
model: kubernetes
name: default
namespace: ""
namespace: default
settings: {}
traits:
meshmap:
edges: []
fieldRefData: {}
id: 7716aff1-55d9-4641-96dd-e8d0075783f8
id: a45faf23-bb79-4de1-9177-4b5eb71783a6
label: Namespace
meshmodel-data:
category:
metadata: null
name: Orchestration & Management
components: null
description: ""
components: []
displayName: Kubernetes
hostID: 26e64aa8-2d86-57bd-92b3-2a73160d27b4
id: a5d424b9-55b1-5767-a451-a250c4098685
hostID: 00000000-0000-0000-0000-000000000000
id: d247c4d8-3c7f-5e48-8158-2fba74f1c41c
metadata:
isAnnotation: false
svgColor: ui/public/static/img/meshmodels/kubernetes/color/kubernetes-color.svg
svgWhite: ui/public/static/img/meshmodels/kubernetes/white/kubernetes-white.svg
model:
version: v1.25.2
name: kubernetes
registrant:
hostname: artifacthub
relationships: null
schemaVersion: core.meshery.io/v1beta1
status: enabled
subCategory: ""
version: v1.0.0
relationships: []
THEBOSS0369 marked this conversation as resolved.
Show resolved Hide resolved
status: registered
version: v1.25.2
meshmodel-metadata:
capabilities: |2-
{
Expand All @@ -415,34 +414,36 @@ services:
model: kubernetes
modelDisplayName: Kubernetes
primaryColor: '#326CE5'
published: true
secondaryColor: '#7aa1f0'
shape: rectangle
shapePolygonPoints: ""
status: enabled
styleOverrides:
background-image: none
background-opacity: 0.5
border-style: dashed
border-width: 2
z-index: 7
z-index: 5
styles: '{"background-image":"none","border-width":2,"border-style":"dashed","background-opacity":0.5}'
subCategory: ""
svgColor: ui/public/static/img/meshmodels/kubernetes/color/namespace-color.svg
svgComplete: ui/public/static/img/meshmodels/kubernetes/complete/namespace-complete.svg
svgWhite: ui/public/static/img/meshmodels/kubernetes/white/namespace-white.svg
position:
posX: 470
posY: 459
whiteboardData: {}
posX: 647.25
posY: 399
whiteboardData:
style:
z-index: 5
type: Namespace
version: v1.25.2
role-yh:
annotations: {}
apiVersion: rbac.authorization.k8s.io/v1
dependsOn:
- default-aomif
- default-zaidv
id: null
isAnnotation: null
isAnnotation: false
labels: {}
model: kubernetes
name: role-yh
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ version: 0.0.4
name: aws-k8s-cni.yaml
displayName: aws-k8s-cni.yaml
createdAt: "2024-07-20T06:36:23Z"
description: Aws integration with kubernetes
description: AWS CNI networking integration with Kubernetes
THEBOSS0369 marked this conversation as resolved.
Show resolved Hide resolved
logoURL: https://raw.githubusercontent.com/meshery/meshery.io/0b8585231c6e2b3251d38f749259360491c9ee6b/assets/images/brand/meshery-logo.svg
license: Apache-2.0
homeURL: https://docs.meshery.io/concepts/logical/designs
Expand Down
12 changes: 6 additions & 6 deletions catalog/f970dc8a-137e-49cc-a53e-362a924bf726/0.0.4/design.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
name: aws-k8s-cni.yaml
version: 0.0.5
version: 0.0.6
services:
aws-node-dwdkd:
annotations: {}
apiVersion: rbac.authorization.k8s.io/v1
dependsOn: []
id: null
isAnnotation: null
isAnnotation: false
labels:
app.kubernetes.io/instance: aws-vpc-cni
app.kubernetes.io/name: aws-node
Expand Down Expand Up @@ -132,7 +132,7 @@ services:
apiVersion: rbac.authorization.k8s.io/v1
dependsOn: []
id: null
isAnnotation: null
isAnnotation: false
labels:
app.kubernetes.io/instance: aws-vpc-cni
app.kubernetes.io/name: aws-node
Expand Down Expand Up @@ -197,7 +197,7 @@ services:
apiVersion: v1
dependsOn: []
id: null
isAnnotation: null
isAnnotation: false
labels:
app.kubernetes.io/instance: aws-vpc-cni
app.kubernetes.io/name: aws-node
Expand Down Expand Up @@ -268,7 +268,7 @@ services:
apiVersion: apps/v1
dependsOn: []
id: null
isAnnotation: null
isAnnotation: false
labels:
app.kubernetes.io/instance: aws-vpc-cni
app.kubernetes.io/name: aws-node
Expand Down Expand Up @@ -494,7 +494,7 @@ services:
apiVersion: apiextensions.k8s.io/v1
dependsOn: []
id: null
isAnnotation: null
isAnnotation: false
labels:
app.kubernetes.io/instance: aws-vpc-cni
app.kubernetes.io/name: aws-node
Expand Down
33 changes: 33 additions & 0 deletions check-unused-css.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// Script for the checking of unused css

const { exec } = require('child_process');
const path = require('path');

// Get the CSS file name from the command line arguments
const cssFileName = process.argv[2];

if (!cssFileName) {
console.error('Error: Please provide a CSS file name as an argument.');
process.exit(1);
}

// Construct the command to run PostCSS with PurgeCSS
const postcssCommand = `npx postcss ${path.join('_sass', cssFileName)} -o ./output/${cssFileName} --config ./postcss.config.js`;

exec(postcssCommand, (error, stdout, stderr) => {
if (error) {
console.error(`Error: ${error.message}`);
return;
}
if (stderr) {
console.error(`Error: ${stderr}`);
return;
}

// If no errors, print a success message with more details
console.log(`Success: The file '${cssFileName}' was processed successfully.`);
console.log(`The output has been saved to './output/${cssFileName}'`);
console.log(`NOTE: ALL THE UNUSED CSS IS REMOVED FROM THE UPDATED FILE`);
});


Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ userName: Rahul Rana
userAvatarURL: https://lh3.googleusercontent.com/a/ACg8ocJqDwcL0l-dPTe8Ic7gU-BoXl2uje2bBhZyCQe52y7upfoZCI43=s96-c
type: workloads
compatibility:
- kubernetes
- awx-operator
- kubernetes
patternId: f970dc8a-137e-49cc-a53e-362a924bf726
image: https://raw.githubusercontent.com/layer5labs/meshery-extensions-packages/master/action-assets/design-assets/f970dc8a-137e-49cc-a53e-362a924bf726-light.png,https://raw.githubusercontent.com/layer5labs/meshery-extensions-packages/master/action-assets/design-assets/f970dc8a-137e-49cc-a53e-362a924bf726-dark.png
patternInfo: |
Aws%20integration%20with%20kubernetes
AWS%20CNI%20networking%20integration%20with%20Kubernetes
THEBOSS0369 marked this conversation as resolved.
Show resolved Hide resolved
patternCaveats: |
No%20caveats
permalink: catalog/workloads/aws-k8s-cni-yaml-f970dc8a-137e-49cc-a53e-362a924bf726.html
Expand Down
28 changes: 28 additions & 0 deletions postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
const purgecss = require('@fullhuman/postcss-purgecss');

module.exports = {
syntax: require('postcss-scss'),
plugins: [
purgecss({
content: [
// Change the path to match your HTML files in which you want to check unused css i'm checking all files at once
'./**/*.html',
// same for the js, i am checking all js files at once
'./**/*.js',
],
// First change the below code and then add the file name you want.
// For e.g. i checked it using variables.scss
css: ['./_sass/testimonials.scss'],

// and run this in terminal ->

// npx postcss _sass/variables.scss -o ./output/variables.css --config ./postcss.config.js

// change the variables to the file you want to check
safelist: [], // Add any CSS selectors you want to keep
keyframes: true,
fontFace: true,
// adding this line to for commiting with sign off
}),
],
};
Loading