Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

esbuild-plugin-filelastmodified

Package Overview
Dependencies
Maintainers
1
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

esbuild-plugin-filelastmodified - npm Package Compare versions

Comparing version 1.0.1 to 1.0.2

8

package.json
{
"name": "esbuild-plugin-filelastmodified",
"version": "1.0.1",
"version": "1.0.2",
"repository": "https://github.com/g45t345rt/esbuild-plugin-filelastmodified",

@@ -16,9 +16,9 @@ "description": "A esbuild plugin to replace __fileLastModified__ with the actual time the file has been modified.",

"devDependencies": {
"@types/node": "^14.14.35",
"@types/node": "^14.14.37",
"chai": "^4.3.4",
"cross-env": "^7.0.3",
"esbuild": "^0.9.6",
"esbuild": "^0.11.2",
"mocha": "^8.3.2",
"typescript": "^4.2.3"
}
}
}
# esbuild-plugin-filelastmodified
A esbuild plugin to replace `__fileLastModified__` with the actual time the file has been modified.
A esbuild plugin to replace `__fileLastModified__` with the date the file was last modified.
## Why
Avoid having to manually change the the last time the file was modified everytime you make an edit.
Avoid having to manually hardcode the date and change it every time you make an edit on your website pages. It's very usefull for displaying -> `Modified date: 2021-03-31` at the end of web pages.

@@ -14,3 +14,3 @@ ## Install

## Usage
## Apply plugin to esbuild

@@ -29,2 +29,19 @@ ```js

## How I would actually use it in React
```js
// Home.js
import React from 'react'
import dayjs from 'dayjs'
import localizedFormat from 'dayjs/plugin/localizedFormat'
dayjs.extend(localizedFormat)
const lastModified = __fileLastModified__ // <-- this gets replaced by the plugin as unix date time
export default () => {
return <div>{dayjs(lastModified).format('LLL')}</div>
}
```
### Conversion
#### Before

@@ -31,0 +48,0 @@ ```js

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc