<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Elizabeth Simonian on Medium]]></title>
        <description><![CDATA[Stories by Elizabeth Simonian on Medium]]></description>
        <link>https://medium.com/@esimonian16?source=rss-b40e0f5237e8------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*oORL0TJC_mEWJcmr6aeMug.jpeg</url>
            <title>Stories by Elizabeth Simonian on Medium</title>
            <link>https://medium.com/@esimonian16?source=rss-b40e0f5237e8------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 02:55:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@esimonian16/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Setting up a Shopify app with Rails 5.1, Webpack, React, and Polaris]]></title>
            <link>https://medium.com/@esimonian16/setting-up-a-shopify-app-with-rails-5-1-webpack-react-and-polaris-b8535d911275?source=rss-b40e0f5237e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/b8535d911275</guid>
            <category><![CDATA[rails]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[shopify]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[polaris]]></category>
            <dc:creator><![CDATA[Elizabeth Simonian]]></dc:creator>
            <pubDate>Wed, 14 Jun 2017 20:58:24 GMT</pubDate>
            <atom:updated>2017-06-14T21:46:13.422Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve been working with Rails/React a lot recently and have just started using them to develop a couple of Shopify apps. It’s a bit of process to get set up so here’s a quick (hopefully beginner friendly) run down. We’ll be creating an embedded app that can use Shopify’s new <a href="https://polaris.shopify.com/">Polaris components</a>.</p><h3>1. Generating a new applicaton</h3><p>Let’s set up a new rails app (make sure you’re using Rails 5.1)</p><pre>rails new &lt;APP NAME&gt; --webpack=react -d postgresql -T</pre><p>The last two arguments are optional but I like to set up my apps with Postgres (to make deploying to Heroku easier) and skip the tests so that I can replace them rspec.</p><p>Add Shopify’s gem to your gem file, run bundle install, and create your database</p><pre>#Gemfile<br>gem &#39;shopify_app&#39;</pre><pre>&gt; bundle install<br>&gt; rake db:create</pre><h3>2. Tunneling &amp; Installing ngrok</h3><p>To use some of Shopify’s features such as Application Proxy and Webhooks you’ll need to set up a tunnel to expose your local server to an actual url. I do this for all apps though because it helps avoid loading errors due to mixed content issues. Luckily ngrok makes this pretty easy. Head over to <a href="https://ngrok.com/">their site</a> and download and install using your OS’s instructions. Then run the following command. (I’m setting this to tunnel from localhost port 5000 instead of rail’s default. We’ll see why a little later)</p><p>** the -subdomain argument is a premium feature but makes Shopify development MUCH easier. Highly recommend the upgrade</p><pre>ngrok http -subdomain=shopifyapp 5000</pre><p>We’ll now be able use the “https://shopifyapp.ngrok.io” to access our app</p><h3>3. Shopify Partner Accounts &amp; App Creation</h3><p>Next let’s head over to <a href="https://www.shopify.com/partners">https://www.shopify.com/partners</a> and login or set up an account. This will allow us to create and sell apps as well as set up development stores.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/894/1*hEm8KtgkiywzhBJ4BlTdmA.png" /></figure><p>Click on the create app button in the app page of your dashboard. Use ngrok url that we generated earlier.</p><p>Now head to the app info tab and change the Whitelisted redirection URL to “https://shopifyapp.ngrok.io/auth/shopify/callback”</p><p>Then go to the extensions tab and make sure “Embed in Shopify admin” is enabled.</p><p>Finally, let’s go back to the overview tab and generate our app’s api credentials. We’ll need them for the next step.</p><h3>4. Generating a Base App Using the Shopify Gem Installer</h3><p>Now we can get our app set up quickly by running</p><pre>rails generate shopify_app:install --api_key &lt;your_api_key&gt; --secret &lt;your_app_secret&gt;</pre><p>As of writing this the migration file this command creates will need to be updated to work with Rails 5.1. Head to db/migrate/create_shops.rb and make sure the top line looks like this</p><pre>class CreateShops &lt; ActiveRecord::Migration[5.1]</pre><p>now run</p><pre>rake db:migrate</pre><h3>5. Installing Polaris and Setting up a Basic React Component</h3><p>Now that the Rails section of our app is set up let’s get React working. First we’ll install Polaris by running</p><pre>yarn add @shopify/polaris</pre><p>When we set up the app with webpacker it generated some basic react components. Let’s modify one to use some Polaris components</p><pre># app/javascript/packs/hello_react.jsx</pre><pre>import React from &#39;react&#39;<br>import ReactDOM from &#39;react-dom&#39;<br>import PropTypes from &#39;prop-types&#39;<br>import {Page, Card, Button, Thumbnail} from &#39;<a href="http://twitter.com/shopify/polaris">@shopify/polaris</a>&#39;;</pre><pre>const Hello = props =&gt; (<br>   &lt;Page title=&quot;Products&quot;&gt;<br>    {props.products.map((product, index) =&gt; (<br>    &lt;Card key={index}<br>      title={product.title}<br>      primaryFooterAction={{<br>        content: &#39;View&#39;,<br>        url: &#39;<a href="https://${shop_session.url}/admin/products/$%7Bproduct.id%7D&#39;">https://${shop_session.url}/admin/products/${product.id}&#39;</a>,<br>      }}<br>      sectioned<br>    &gt;<br>        &lt;Thumbnail<br>          source={product.images[0].src}<br>          alt={product.title}<br>          size=&quot;large&quot;<br>        /&gt;<br>      <br>    &lt;/Card&gt;   <br>    ))}<br>  &lt;/Page&gt;<br>)</pre><pre>// Render component with data<br>document.addEventListener(&#39;DOMContentLoaded&#39;, () =&gt; {<br>  const node = document.getElementById(&#39;hello-react&#39;)<br>  const data = JSON.parse(node.getAttribute(&#39;data&#39;))</pre><pre>ReactDOM.render(&lt;Hello {...data} /&gt;, node)<br>})</pre><p>Now lets add this component to our app’s layout file by adding the following in the head tags</p><pre>&lt;%= javascript_pack_tag &#39;hello_react&#39; %&gt;</pre><p>* Make sure you put this in the embedded_app.html.erb file that the Shopify gem created for us and NOT application.html.erb. Other wise you’ll end up like me spending 15 minutes why I couldn’t get anything to show up</p><p>Then add the the component to the views/home/index.html.erb file</p><pre>&lt;% content_for :javascript do %&gt;<br>  &lt;script type=&quot;text/javascript&quot;&gt;<br>    ShopifyApp.ready(function(){<br>      ShopifyApp.Bar.initialize({<br>        title: &quot;Home&quot;,<br>        icon: &quot;&lt;%= asset_path(&#39;favicon.ico&#39;) %&gt;&quot;<br>      });<br>    });<br>  &lt;/script&gt;<br>&lt;% end %&gt;</pre><pre>&lt;%= content_tag :div,<br>  id: &quot;hello-react&quot;,<br>  data: {<br>    name: &#39;Person&#39;,<br>    products: <a href="http://twitter.com/products">@products</a>,<br>    shop_session: <a href="http://twitter.com/shop_session">@shop_session</a><br>}.to_json do %&gt;<br>&lt;% end %&gt;</pre><p>Make sure to remove this line or add a favicon in your assets folder</p><pre>icon: &quot;&lt;%= asset_path(&#39;favicon.ico&#39;) %&gt;&quot;</pre><h3>6. Configuring our local server with Foreman</h3><p>We’re almost ready to check out our app but first let’s make our lives easier by using Foreman to start or local server. If you don’t you’ll need to run the rails and webpack servers in separate terminal tabs. This gets old pretty quickly. Luckily there’s an easy work around (you can see the original instructions <a href="https://github.com/rails/webpacker#webpack-dev-server">here</a>.</p><p>In terminal run</p><pre>&gt; gem install foreman<br>&gt; touch Procfile</pre><p>In the Procfile add the following lines</p><pre>web: bundle exec rails s<br>webpacker: ./bin/webpack-dev-server</pre><p>This is also a good time to head over to config/webpacker.yml and make sure that the dev_server is set to use https. (this will help us avoid loading and content errors)</p><pre>dev_server:<br>    host: 0.0.0.0<br>    port: 8080<br>    https: true</pre><p>now run</p><pre>foreman start</pre><h3>7. Check Out Your New App on a Development Store</h3><p>Make sure you have a development store set up and head to your ngrok url.</p><p>You’ll be prompted to install your app by entering your shop’s domain like this.</p><p>&lt;STORE NAME&gt;.myshopify.com</p><p>Once it’s installed you should be able to see a list of products and our React button</p><p>Not much of an app yet but hopefully this set up will let you go out and create something great! I plan on adding a second part to this walk through to show give some more in depth React examples</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b8535d911275" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Middleman and Contenful]]></title>
            <link>https://medium.com/@esimonian16/middleman-and-contenful-741706712531?source=rss-b40e0f5237e8------2</link>
            <guid isPermaLink="false">https://medium.com/p/741706712531</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[contentful]]></category>
            <category><![CDATA[middleman]]></category>
            <category><![CDATA[static-site-generator]]></category>
            <category><![CDATA[blogging]]></category>
            <dc:creator><![CDATA[Elizabeth Simonian]]></dc:creator>
            <pubDate>Fri, 25 Nov 2016 08:37:18 GMT</pubDate>
            <atom:updated>2016-11-25T08:41:52.235Z</atom:updated>
            <content:encoded><![CDATA[<p>I’ve been wanting to set up a blog with Middleman and Contentful for awhile and finally got around to it last night. Unfortunately, there isn’t much documentation for setting this up with Middleman v4 and it took me awhile to figure it out. So for any one else struggling here goes…</p><h4>1. Add this to your gem file</h4><pre>gem &#39;contentful_middleman&#39;, :git =&gt; &quot;git://github.com/contentful/contentful_middleman.git&quot;, :branch =&gt; &quot;dl/upgrade-to-v4&quot;</pre><h4>2. Add this to your gem file</h4><pre><br>activate :contentful do |f|<br>  f.access_token  = &#39;RANDOMNUMBERS&#39;<br>  f.space         = { site: &#39;RANDOMNUMBERS&#39; }<br>  f.all_entries = true<br>  f.cda_query = { limit: 1000 }<br>  f.content_types = { Post: &#39;blog&#39;} <br>end</pre><h4>3. Run these commands</h4><pre>bundle install<br>middleman contentful</pre><h4>4. Enjoy your new data files and go proxy some pages</h4><h4>P.S.</h4><p>It took me forever to figure out where all the info above is in Contenful so here are some pictures (Just match the numbers )</p><pre>activate :contentful do |f|<br>  f.access_token  = &#39;[4]&#39;<br>  f.space         = { site: &#39;[3]&#39; }<br>  f.all_entries = true<br>  f.cda_query = { limit: 1000 }<br>  f.content_types = { [2]: &#39;[1]&#39;} <br>end</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nbNTjL6gUznBg48S7MgmEg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9WeyS44pA5avrOgAEZ5JGg.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=741706712531" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>