Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22395528
README.md
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
README.md
View Options
#
Autosizes
Parse
This
module
generates
a
sizes
string
for
responsive
images
based
on
measurement
data
.
It
analyzes
the
measurements
and
generates
a
sizes
string
that
describes
the
behavior
of
the
image
'
s
sizes
attribute
.
##
Installation
Make
sure
you
have
Node
.
js
version
17
or
later
installed
.
You
can
install
the
package
using
npm
:
```
bash
npm
install
@
sealcode
/
autosizes
-
parser
```
##
Usage
You
can
import
the
`
generateSizes
`
function
from
the
module
and
use
it
to
generate
the
sizes
string
based
on
your
measurement
data
.
```
typescript
import
generateSizes
from
'
@
sealcode
/
autosizes
-
parser
'
;
import
data
from
'
./
data
/
measurement
.
json
'
;
// measurement data path
const
sizesString
=
generateSizes
(
data
);
console
.
log
(
sizesString
);
```
Example
output
:
```
(
max
-
width
:
400
px
)
calc
(
100
vw
/
-
2
+
480
px
),
(
max
-
width
:
600
px
)
calc
(
100
vw
/
-
2
+
602
px
),
(
max
-
width
:
880
px
)
calc
(
100
vw
/
4
-
40
px
),
440
px
```
##
File
Structure
The
module
is
structured
as
follows
:
```
src
/
└──
autosizeparse
.
ts
#
Module
implementation
└──
autosizeparse
.
test
.
ts
#
Test
suite
for
the
module
└──
index
.
ts
#
Export
of
generateSizes
function
data
/
└──
test
.
json
#
Example
test
data
in
JSON
format
```
##
Running
Tests
Tests
ensure
that
the
module
functions
correctly
.
You
can
run
the
tests
using
the
following
command
:
```
bash
npm
test
```
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, Nov 27, 16:27 (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1191636
Default Alt Text
README.md (1 KB)
Attached To
Mode
R139 autosizes-parser
Attached
Detach File
Event Timeline