Skip to content

Commit 26bac28

Browse files
Replaced the external reading-time dependency with the local readTime function
1 parent 6e78885 commit 26bac28

File tree

4 files changed

+8
-12
lines changed

4 files changed

+8
-12
lines changed

src/lib/layouts/blog-layout/BlogLayout.svelte

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script lang="ts">
2-
import reading from 'reading-time';
3-
42
import { onMount } from 'svelte';
53
64
// Environment
@@ -17,6 +15,7 @@
1715
1816
// Utils
1917
import { blogTypeDate } from '$utils/date-formatters';
18+
import { readingTime } from '$lib/utils/reading-time';
2019
2120
// Exports
2221
@@ -83,7 +82,7 @@
8382
8483
// Local Methods
8584
onMount(() => {
86-
readingTimeDuration = reading(`${document.getElementById('blog-conent').textContent}`).text;
85+
readingTimeDuration = readingTime(`${document.getElementById('blog-conent').textContent}`).time;
8786
});
8887
</script>
8988

src/lib/layouts/newsletter-layout/NewsLetterLayout.svelte

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script lang="ts">
2-
import reading from 'reading-time';
3-
42
import { onMount } from 'svelte';
53
64
// Environment
@@ -17,6 +15,7 @@
1715
1816
// Utils
1917
import { blogTypeDate } from '$utils/date-formatters';
18+
import { readingTime } from '$lib/utils/reading-time';
2019
2120
// Exports
2221
@@ -83,7 +82,7 @@
8382
8483
// Local Methods
8584
onMount(() => {
86-
readingTimeDuration = reading(`${document.getElementById('blog-conent').textContent}`).text;
85+
readingTimeDuration = readingTime(`${document.getElementById('blog-conent').textContent}`).time;
8786
});
8887
</script>
8988

src/lib/layouts/snippets-layout/SnippetsLayout.svelte

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script lang="ts">
2-
import reading from 'reading-time';
3-
42
import { onMount } from 'svelte';
53
64
// Environment
@@ -15,6 +13,7 @@
1513
1614
// Utils
1715
import { blogTypeDate } from '$utils/date-formatters';
16+
import { readingTime } from '$lib/utils/reading-time';
1817
1918
// Exports
2019
@@ -80,7 +79,7 @@
8079
8180
// Local Methods
8281
onMount(() => {
83-
readingTimeDuration = reading(`${document.getElementById('blog-conent').textContent}`).text;
82+
readingTimeDuration = readingTime(`${document.getElementById('blog-conent').textContent}`).time;
8483
});
8584
</script>
8685

src/lib/layouts/uses-layout/UsesLayout.svelte

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
<script lang="ts">
2-
import reading from 'reading-time';
3-
42
import { onMount } from 'svelte';
53
64
// Environment
@@ -17,6 +15,7 @@
1715
1816
// Utils
1917
import { blogTypeDate } from '$utils/date-formatters';
18+
import { readingTime } from '$lib/utils/reading-time';
2019
2120
// Exports
2221
export let title = '';
@@ -82,7 +81,7 @@
8281
8382
// Local Methods
8483
onMount(() => {
85-
readingTimeDuration = reading(`${document.getElementById('blog-conent').textContent}`).text;
84+
readingTimeDuration = readingTime(`${document.getElementById('blog-conent').textContent}`).time;
8685
});
8786
</script>
8887

0 commit comments

Comments
 (0)