<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: ANSH VARUN</title>
    <description>The latest articles on DEV Community by ANSH VARUN (@anshcena).</description>
    <link>https://dev.to/anshcena</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F388540%2Fea51b36a-5f96-4d2c-a5e6-94d031a1dba2.png</url>
      <title>DEV Community: ANSH VARUN</title>
      <link>https://dev.to/anshcena</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/anshcena"/>
    <language>en</language>
    <item>
      <title>Generate resources for Nuxt-Capacitor-Integration</title>
      <dc:creator>ANSH VARUN</dc:creator>
      <pubDate>Thu, 03 Dec 2020 21:00:53 +0000</pubDate>
      <link>https://dev.to/anshcena/generate-resources-for-nuxt-capacitor-integration-19pj</link>
      <guid>https://dev.to/anshcena/generate-resources-for-nuxt-capacitor-integration-19pj</guid>
      <description>&lt;ul&gt;
&lt;li&gt;Create &lt;em&gt;resources&lt;/em&gt; folder in root directory.&lt;/li&gt;
&lt;li&gt;Add &lt;em&gt;icon.png&lt;/em&gt; with size - 1024x1024 px Add &lt;em&gt;splash.png&lt;/em&gt; with size - 2732x3732 px&lt;/li&gt;
&lt;li&gt;So we have placed icon and splash in resources folder, now we need these in all sizes compatible with our android and ios platforms.&lt;/li&gt;
&lt;li&gt;Lets add script to generate it and then &lt;em&gt;sync&lt;/em&gt; it to platform.&lt;/li&gt;
&lt;li&gt;Add the following command to scripts in &lt;strong&gt;package.json&lt;/strong&gt; file of nuxt app&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;"resources": "cordova-res-generator -p android,ios &amp;amp;&amp;amp; node resources/sync.js android"&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;As we see, we have used &lt;strong&gt;&lt;a href="https://www.npmjs.com/package/cordova-res-generator#installation"&gt;cordova-res-generator&lt;/a&gt;&lt;/strong&gt; so lets install this generator by&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;yarn add --dev cordova-res-generator&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;We have successfully add res-generator now we are ready to go but we still have &lt;strong&gt;node resources/sync.js android&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This will sync the resources to android platform using sync.js, so lets add sync.js in resources where we have added our icon and splash&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;a href="https://github.com/anshcena/blog/blob/main/nuxt-capacitor/sync.js"&gt;Sync.js&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Copy the code from above mentioned &lt;a href="https://github.com/anshcena/blog/blob/main/nuxt-capacitor/sync.js"&gt;Sync.js&lt;/a&gt; to generate sync.js inside resources.&lt;/p&gt;

&lt;p&gt;so our resources will have these 3 :&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--QPy8YOYL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/anshcena/blog/blob/main/nuxt-capacitor/img/sync%2520file.jpg%3Fraw%3Dtrue" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--QPy8YOYL--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://github.com/anshcena/blog/blob/main/nuxt-capacitor/img/sync%2520file.jpg%3Fraw%3Dtrue" alt="Structure resources" title="Resources"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We are ready to generate and sync now&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;yarn resources&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;🎉 Resources are generated and sync to platfrom - android 🎉&lt;/p&gt;

&lt;p&gt;For &lt;strong&gt;iOS&lt;/strong&gt; , we can make change in scripts of package.json as &lt;strong&gt;node/sync.js ios&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Make sure to put logo in splash screen in middle as well as small for better resource generated results and optimized images.&lt;/em&gt;&lt;/p&gt;

</description>
    </item>
  </channel>
</rss>
