layout | title |
---|---|
default |
Static Assets |
To use static assets (such as images) with your component, simply include them anywhere within your project folder. For example:
├── ...
└── jane-doe/
└── hello-famous/
├── hello-famous.js
└── my-image.jpg
Then, within your hello-famous.js
entrypoint file, you can refer to that asset using special syntax for asset interpolation, {{BASE_URL}}
:
FamousFramework.component('jane-doe:hello-famous', {
tree:`<node id="imageNode">
<img src="{{BASE_URL}}my-image.png">
</node>`
});
Refer to famous-tests:static-assets for a working example of this concept.