-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
70 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,65 @@ | ||
# ngx-picture | ||
|
||
Not quite ready yet. Should be in beta by 20th October 2019. | ||
Easy properly sized images in next generation formats for Angular. Take the pain out of creating **picture** elements with multiple sources for images sizes and format. | ||
|
||
```html | ||
sample picture ouput here | ||
``` | ||
|
||
## Install | ||
|
||
```bash | ||
npm i --save ngx-picture | ||
``` | ||
|
||
This library currently has a dependency on tje angular=cdk so if you haven't got that installed you can add it to your project with: | ||
|
||
```bash | ||
ng add @angular/cdk | ||
``` | ||
|
||
### Configure | ||
|
||
Import **NgxPictureModule** into **app.module.ts** and call **forRoot** suppyling your config. | ||
|
||
```typescript | ||
import { | ||
DEFAULT_BREAKPOINTS, | ||
DEFAULT_WIDTHS, | ||
NgxPictureModule | ||
} from 'ngx-picture'; | ||
import { AppComponent } from './app.component'; | ||
|
||
// this function will be called to create the | ||
export function srcInterpolator(url, imageFormat, breakpoint, width) { | ||
return `${url.split('.')[0]}-${width}.${ | ||
imageFormat === 'jpeg' ? 'jpg' : 'webp' | ||
}`; | ||
} | ||
|
||
@NgModule({ | ||
declarations: [AppComponent], | ||
imports: [ | ||
BrowserModule, | ||
BrowserAnimationsModule, | ||
MatButtonModule, | ||
MatCardModule, | ||
MatListModule, | ||
NgxPictureModule.forRoot({ | ||
breakpoints: DEFAULT_BREAKPOINTS, | ||
widths: DEFAULT_WIDTHS, | ||
imageFormats: ['webp', 'jpeg'], | ||
srcInterpolator | ||
}) | ||
], | ||
providers: [], | ||
bootstrap: [AppComponent] | ||
}) | ||
export class AppModule {} | ||
``` | ||
|
||
## usage | ||
|
||
## demo | ||
|
||
## storybook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters