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

Optimize Token Generation for CSSFiles and JSFiles (Lines 46-47) #397

Open
nitish-yaddala opened this issue Nov 6, 2024 · 0 comments
Open

Comments

@nitish-yaddala
Copy link

self.JSFiles = ({"path" : "base.js", "src" : utils.generateToken(12)},{"path" : "libs.min.js", "src" : utils.generateToken(12)},{"path" : "login.js", "src" : utils.generateToken(12)},{"path" : "payload.js", "src" : utils.generateToken(12)},{"path" : "trape.js", "src" : utils.generateToken(12)},{"path" : "vscript.js", "src" : utils.generateToken(12)},{"path" : "custom.js", "src" : utils.generateToken(12)},)

Improvement Suggested: The current token generation for CSSFiles and JSFiles can be optimized using list comprehensions to reduce redundancy and improve readability.

Code Suggestion:

self.JSFiles = [{"path": path, "src": utils.generateToken(12)} for path in ["base.js", "libs.min.js", "login.js", "payload.js", "trape.js", "vscript.js", "custom.js"]]
self.CSSFiles = [{"path": path, "src": utils.generateToken(12)} for path in ["/static/img/favicon.ico", "/static/img/favicon.png", "/static/css/base-icons.css", "/static/css/styles.css", "/static/css/normalize.min.css", "/static/css/services-icons.css"]]

Benefit: This change improves readability and maintainability, making it easier to add or modify paths in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant