From 43c8314682fc9a1184fc51c1acd3653d171c058d Mon Sep 17 00:00:00 2001 From: Martijn Date: Thu, 10 Sep 2020 09:04:36 +0200 Subject: [PATCH 1/2] Update images.md Added notes on how to include additional local resources (like images) to your build so that are available in the deployed app. --- docs/ui/images.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/docs/ui/images.md b/docs/ui/images.md index 6552ed18e..effc816a5 100644 --- a/docs/ui/images.md +++ b/docs/ui/images.md @@ -80,6 +80,24 @@ Using the `~/` prefix, you can load images relative to the `App` folder inside y ``` {% endangular %} +The actual mapping of the `~/` to this `app` folder is configured in the `tsconfig.json` file under the `compilerOptions` property. + +```yaml +"paths": { + "~/*": [ + "app/*" + ] +``` + +For images to be available in the app they need to be included in the build process. To include the files make sure they are copied during the build. This is done by adding a additional target to the `copyTargets` in the `webpack.config.js`. + +```JavaScript + const copyTargets = [ + ... + { from: 'images/**', noErrorOnMissing: false, globOptions: { dot: false, ...copyIgnore } }, + ]; +``` + You can manually create an [ImageSource instance from local file]({%ns_cookbook image-source#load-image-from-a-local-file%}). > Currently, loading images from the file system does not respect filename qualifiers as described [here]({% slug architecture %}#supporting-multiple-screens). We have plans to implement that along with [density-specific qualifiers support](https://github.com/NativeScript/NativeScript/issues/276). From 5dede6ef05c328954e2bcb60c98ea61568195a3c Mon Sep 17 00:00:00 2001 From: Martijn Date: Thu, 10 Sep 2020 09:44:09 +0200 Subject: [PATCH 2/2] docs: Fixed a typo This is to trigger to PR validation --- docs/ui/images.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/ui/images.md b/docs/ui/images.md index effc816a5..278bff597 100644 --- a/docs/ui/images.md +++ b/docs/ui/images.md @@ -80,7 +80,7 @@ Using the `~/` prefix, you can load images relative to the `App` folder inside y ``` {% endangular %} -The actual mapping of the `~/` to this `app` folder is configured in the `tsconfig.json` file under the `compilerOptions` property. +The actual mapping between the `~/` to this `app` folder is configured in the `tsconfig.json` file under the `compilerOptions` property. ```yaml "paths": {