<?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: Ahmad Ajmi</title>
    <description>The latest articles on DEV Community by Ahmad Ajmi (@ahmadajmi).</description>
    <link>https://dev.to/ahmadajmi</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%2F284%2Fdb2a90d2-007f-4486-bd3b-94f494024306.jpg</url>
      <title>DEV Community: Ahmad Ajmi</title>
      <link>https://dev.to/ahmadajmi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ahmadajmi"/>
    <language>en</language>
    <item>
      <title>Tools I Use to Develop, Edit and Deploy Ghost Themes</title>
      <dc:creator>Ahmad Ajmi</dc:creator>
      <pubDate>Fri, 05 Mar 2021 13:52:03 +0000</pubDate>
      <link>https://dev.to/ahmadajmi/tools-i-use-to-develop-edit-and-deploy-ghost-themes-4ji8</link>
      <guid>https://dev.to/ahmadajmi/tools-i-use-to-develop-edit-and-deploy-ghost-themes-4ji8</guid>
      <description>&lt;p&gt;In this issue, I would like to share the tools I use to build Ghost themes professionally at &lt;a href="https://aspirethemes.com/"&gt;Aspire Themes&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I will divide it into four sections. The editor, the command-line tool, producing the zip file to be ready to upload and an alternative way to deploy the theme to your website using GitHub.&lt;/p&gt;

&lt;h3&gt;
  
  
  1) Editor
&lt;/h3&gt;

&lt;p&gt;I use &lt;a href="https://code.visualstudio.com/"&gt;Visual Studio Code&lt;/a&gt; as my main code editor. It is free, open-source, and runs on all operating systems. A good alternative is &lt;a href="https://www.sublimetext.com/"&gt;Sublime Text&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  2) Command Line
&lt;/h3&gt;

&lt;p&gt;I use &lt;a href="https://iterm2.com/index.html"&gt;iTerm2&lt;/a&gt; as a command-line tool on macOS Big Sur. It is an open-source replacement for the macOS Terminal. You are fine to use the built-in Terminal if you don't want the extra features that iTerm2 provides.&lt;/p&gt;

&lt;h3&gt;
  
  
  3) Zip
&lt;/h3&gt;

&lt;p&gt;I use &lt;a href="https://gulpjs.com/"&gt;gulp.js&lt;/a&gt; as an automation toolkit to automate my development workflow. One of the available add-ons is &lt;a href="https://www.npmjs.com/package/gulp-zip"&gt;gulp-zip&lt;/a&gt;. This plugin aims to compress the theme files into a final zip file ready for upload.&lt;/p&gt;

&lt;p&gt;My current gulp zip task is something like.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="nx"&gt;gulp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;task&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;zip&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;gulp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;src&lt;/span&gt;&lt;span class="p"&gt;([&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;./**&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;!node_modules/**&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;!bower_components/**&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;!.git/**&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
    &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;!.DS_Store&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
  &lt;span class="p"&gt;],&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="na"&gt;dot&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt; &lt;span class="p"&gt;})&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;zip&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;NAME.zip&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;pipe&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;gulp&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;dest&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="nx"&gt;done&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
&lt;span class="p"&gt;});&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;So, with the &lt;code&gt;gulp zip&lt;/code&gt; command, I can export the final theme file.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Change &lt;code&gt;NAME&lt;/code&gt; to your theme directory name.&lt;/em&gt;&lt;/p&gt;




&lt;p&gt;If you are not using gulp and want a simple command line to zip the theme, you can use something like.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;zip &lt;span class="nt"&gt;-r&lt;/span&gt; NAME.zip NAME &lt;span class="nt"&gt;-x&lt;/span&gt; &lt;span class="s1"&gt;'*node_modules*'&lt;/span&gt; &lt;span class="s1"&gt;'*bower_components*'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;What comes after the &lt;code&gt;-x&lt;/code&gt; option is a way to exclude different directories or files. This is useful to exclude development files that are not important in production. In this case, we are excluding the &lt;code&gt;node_modules&lt;/code&gt; and &lt;code&gt;bower_components&lt;/code&gt; directories from the final zip file. Not every theme will have these directories. But If you are using nvm, bower, or git to develop your theme, there is no need to include these in the final theme file. In one case, they will be large and not required at all to install your theme successfully.&lt;/p&gt;

&lt;p&gt;If you are not using gulp or don't have any files to exclude, you can compress the theme by doing the following.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;Select the theme folder.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Right-click&lt;/strong&gt; to bring up the pop-up menu.&lt;/li&gt;
&lt;li&gt;Choose &lt;strong&gt;Compress&lt;/strong&gt; &lt;em&gt;"filename"&lt;/em&gt;.&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;The above steps applied to macOS, but you can find something similar for other operating systems.&lt;/p&gt;

&lt;h3&gt;
  
  
  4) Deployment
&lt;/h3&gt;

&lt;p&gt;I use the &lt;a href="https://github.com/marketplace/actions/deploy-ghost-theme"&gt;Deploy Ghost Theme&lt;/a&gt; Github action. This tool helps with theme deployment. This means that instead of zipping your theme, upload it to your website every time you make a change. You can now deploy your theme to your website every time you push a new commit to your theme GitHub repository.&lt;/p&gt;

&lt;p&gt;I wrote a step by step guide about it at &lt;a href="https://aspirethemes.com/blog/deploy-ghost-theme"&gt;How to Deploy Your Ghost Theme Using Github Actions&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  My Current Setup
&lt;/h4&gt;

&lt;p&gt;In case you are wondering what my current environment set up is and which package versions I use, take a look at the following:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="nv"&gt;$ &lt;/span&gt;node &lt;span class="nt"&gt;-v&lt;/span&gt;
v10.16.0

&lt;span class="nv"&gt;$ &lt;/span&gt;npm &lt;span class="nt"&gt;-v&lt;/span&gt;
6.14.8

&lt;span class="nv"&gt;$ &lt;/span&gt;bower &lt;span class="nt"&gt;-v&lt;/span&gt;
1.8.8

&lt;span class="nv"&gt;$ &lt;/span&gt;gulp &lt;span class="nt"&gt;-v&lt;/span&gt;
CLI version: 2.2.0
Local version: 4.0.2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This environment works well for running Ghost and also for theme development.&lt;/p&gt;

&lt;p&gt;I'm using a macOS Big Sur.&lt;/p&gt;




&lt;p&gt;That's it for today, and I hope you find this useful.&lt;/p&gt;

</description>
      <category>ghost</category>
      <category>tools</category>
      <category>gulp</category>
      <category>blogging</category>
    </item>
  </channel>
</rss>
