Closed Vijaykv5 closed 8 months ago
[!IMPORTANT]
Auto Review Skipped
Review was skipped due to path filters
Files ignored due to path filters (2)
* `package.json` is excluded by: `!**/*.json` * `pnpm-lock.yaml` is excluded by: `!**/*.yaml`
This update introduces a more efficient and maintainable approach to handling date formatting in a web application. By externalizing JavaScript logic into a separate script and simplifying the DOM manipulation process, the changes enhance code readability and performance.
File Path | Change Summary |
---|---|
src/.../NuxtTime.vue |
- Added scriptString import- Simplified innerHTML manipulation |
src/script.ts |
- New file for date formatting script - Handles date formatting dynamically |
🐰 Oh, how the dates now gracefully align,
With scripts so sleek, and code divine.
🌟 From chaos to order, our journey we chart,
A tale of refactoring, played with heart.
💻 In the realm of code, we hop with glee,
For cleaner, faster, our apps shall be.
🚀 To the future, we leap, with joy we sing,
"Let's celebrate the changes we bring!"
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
@danielroe May you can review this PR?
Thanks!
New and removed dependencies detected. Learn more about Socket for GitHub ↗︎
Package | New capabilities | Transitives | Size | Publisher |
---|---|---|---|---|
npm/esbuild@0.20.1 | environment, filesystem, network, shell | 0 |
134 kB | evanw |
This doesn't seem to use the minified script at all, just produces it in the dist directory.
you're right! @danielroe
The current code only just minifies it & produce it dist folder.
I need that minified file to Inject in the usehead
but currently its just using the script inside /src/script
not the the minified one inside dist.
I'm new to Vue, May you can help me with it so we can resolve it.
Thanks!
@danielroe May you can suggest me the best way to implement it please?
I really appreciate your time on this. I've implemented it here - I hope that helps in future!
The script is minified and minified script is correctly injected into Nuxt project using useHead.
Steps done :
The provided script is defined as a string, with unnecessary whitespace removed using .replace(/\s+/g, ' ').
The script is then injected into the page using useHead, specifying the script tag's position, key, and innerHTML containing the script.
After running your build process, check the output directory in name of
script.min.js
in /dist folder/claim #3
Summary by CodeRabbit