-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(example): add example for ESM (#79)
Add an example inside the example directory to show the example of how to use the package with the ECMAScript modules standard for the Node.js environment (i.e. import/export syntax) Resolves #72 Signed-off-by: Niloy Sikdar <niloysikdar30@gmail.com>
- Loading branch information
1 parent
63e36eb
commit c7e04f8
Showing
6 changed files
with
87 additions
and
29 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
cat >lib/esm/package.json <<!EOF | ||
{ | ||
"type": "module" | ||
} | ||
!EOF | ||
|
||
echo "Fixup done." |
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 +1,9 @@ | ||
console.log('This will be used with ECMAScript Modules'); | ||
import { generateEmail, generateTextEmail } from '@leopardslab/react-email'; | ||
|
||
import { HelloEmail } from '../lib/esm'; | ||
|
||
const htmlEmail = generateEmail(HelloEmail({ name: 'John' })); | ||
console.log(`HTML email: ${htmlEmail}`); | ||
|
||
const textEmail = generateTextEmail(HelloEmail({ name: 'John' })); | ||
console.log(`Text email: ${textEmail}`); |
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
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