Page MenuHomeSealhub

README.md
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

README.md

# 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: 400px) calc(100vw / -2 + 480px), (max-width: 600px) calc(100vw / -2 + 602px), (max-width: 880px) calc(100vw / 4 - 40px), 440px
```
## 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

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)

Event Timeline