<?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 Antonin Savoie on Medium]]></title>
        <description><![CDATA[Stories by Antonin Savoie on Medium]]></description>
        <link>https://medium.com/@antoninsavoie?source=rss-aed51be9c53------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*UtLLBeh5w3ArnYYq.</url>
            <title>Stories by Antonin Savoie on Medium</title>
            <link>https://medium.com/@antoninsavoie?source=rss-aed51be9c53------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 17 Nov 2026 11:32:19 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@antoninsavoie/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[How to use VueJs instead of jQuery]]></title>
            <link>https://medium.com/kaliop/how-to-use-vuejs-instead-of-jquery-ee6003ba323d?source=rss-aed51be9c53------2</link>
            <guid isPermaLink="false">https://medium.com/p/ee6003ba323d</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[jquery]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[vuejs]]></category>
            <dc:creator><![CDATA[Antonin Savoie]]></dc:creator>
            <pubDate>Mon, 19 Nov 2018 11:56:29 GMT</pubDate>
            <atom:updated>2019-11-18T14:13:58.077Z</atom:updated>
            <content:encoded><![CDATA[<h3>²How to use VueJs instead of jQuery</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*EuQPbxVrXEWCJssVrl-olg.png" /></figure><blockquote>If you want to understand all the content of this article, some knowledge of VueJs is required : <a href="https://vuejs.org/v2/guide/">https://vuejs.org/v2/guide/</a></blockquote><p>I’m lead dev at Kaliop and today I speak about how to use VueJs instead of jQuery.</p><p>For the french version of this article, <a href="https://tech.kaliop.com/utiliser-vue-js-a-la-place-de-jquery/">click here</a>.</p><p>I discovered <a href="https://tech.kaliop.com/en/technologies/vue-js/">VueJs</a> two years ago, and enjoyed to use it since then. I had the chance to work on three VueJs projects, mixed with other technologies. But after that, I came back to more classical “backend” project, with <a href="https://tech.kaliop.com/en/technologies/symfony/">Symfony</a>, eZPublish, even <a href="https://tech.kaliop.com/en/technologies/drupal-8/">Drupal</a>... and with jQuery to handle front click event sometimes.</p><p>We can create great things with that, but I was sad without VueJs, and work was less fun.</p><p>Until the moment I had to synchronize a lot of DOM elements together with jQuery, on an interactive basket for a <a href="https://tech.kaliop.com/en/sub-expertises/e-commerce/">e-commerce platform</a>. I totally blew a fuse, deleted all my code, and I started all over again with VueJs in only one sleepless night. And you know what? My life is happier since then !</p><p>And from that moment, I just wanted to use VueJs everywhere, everytime ! And Iam going to show you how to achieve that.</p><blockquote>Note : shown examples are not perfect, they could be refactored and improved, but I tried to stay as simple as possible. All the code and more is available here <a href="https://github.com/Erilan/replace-jQuery-by-vuejs">github.com/Erilan/replace-jQuery-by-vuejs</a></blockquote><p>First, let’s compare basic samples with jQuery and simple VueJs integration.</p><blockquote>A simple VueJs integration is including the vue library (by CDN for example), a div, and a little piece of script :</blockquote><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0d131c0d5e0531754e61542266fc509f/href">https://medium.com/media/0d131c0d5e0531754e61542266fc509f/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FErilan%2Fembed%2Fpreview%2FdQbZeY%3Fheight%3D600%26slug-hash%3DdQbZeY%26default-tabs%3Djs%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;url=https%3A%2F%2Fcodepen.io%2FErilan%2Fpen%2FdQbZeY&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F595217.dQbZeY.small.820e2aa1-98c0-4d00-9e9e-af1ff8eebac7.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/19f743fa4518bbd6efd4681e23208815/href">https://medium.com/media/19f743fa4518bbd6efd4681e23208815/href</a></iframe><p>Not more complicated than jQuery integration !</p><p>First, let’see a basic dropdown (display a list of item when clicking a button) :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5505b07b9616b0719cea40235e9f9064/href">https://medium.com/media/5505b07b9616b0719cea40235e9f9064/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FErilan%2Fembed%2Fpreview%2FVVZryv%3Fheight%3D600%26slug-hash%3DVVZryv%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;url=https%3A%2F%2Fcodepen.io%2FErilan%2Fpen%2FVVZryv&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F595217.VVZryv.small.a9399814-1ea6-498d-96eb-f3c1ded30cb0.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/6a3f9ac59f1c269842eb487f8c6b4608/href">https://medium.com/media/6a3f9ac59f1c269842eb487f8c6b4608/href</a></iframe><p>Here, the jQuery version is shorter than the VueJs one. It’s a very simple example, it only reacts on a click event, and we toggle a class (jQuery) or we toggle a boolean (Vue). The Vue version is not really better, but it’s a bit more logical : we have a value representing the state of our dropdown, not just a class.</p><p>Now, let’s take a look at basic panels (content displayed when clicking a button) :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0cb94453ab70d41ac1b8b0ec14bef5c0/href">https://medium.com/media/0cb94453ab70d41ac1b8b0ec14bef5c0/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FErilan%2Fembed%2Fpreview%2FzMOPQg%3Fheight%3D600%26slug-hash%3DzMOPQg%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;url=https%3A%2F%2Fcodepen.io%2FErilan%2Fpen%2FzMOPQg&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F595217.zMOPQg.small.fbeb1fcb-fd79-4f91-983c-580abd08fe9a.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/4681c63f58dd29e0e0a0cec84609f02a/href">https://medium.com/media/4681c63f58dd29e0e0a0cec84609f02a/href</a></iframe><p>Here again, the jQuery version is shorter than the VueJs one. Again, we react on a click event, and we play with classes (jQuery), or we set a variable (Vue). Like the previous example, the Vue version is not really better, but it’s more logical. Instead of adding/removing classes, we have a state value representing which content is displayed.</p><p>Ok, go on with a more complicated sample : a recipe serves calculator</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/3049400be01b44a0b4013afb90d5f6f1/href">https://medium.com/media/3049400be01b44a0b4013afb90d5f6f1/href</a></iframe><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FErilan%2Fembed%2Fpreview%2FqQWpqa%3Fheight%3D600%26slug-hash%3DqQWpqa%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;url=https%3A%2F%2Fcodepen.io%2FErilan%2Fpen%2FqQWpqa&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F595217.qQWpqa.small.f8869b75-35fd-435a-b90a-a2e056110ccb.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/c0e1ca7c1a6350ec9660401832f4a111/href">https://medium.com/media/c0e1ca7c1a6350ec9660401832f4a111/href</a></iframe><p>Now, the Vue version is shorter than the jQuery one, and look smarter. In jQuery, we have to react on multiple event types, to read data from the DOM, to write innerHTML and to launch the compute at start.</p><p>In the VueJs solution, code is shorter, and embark more logic. We have a state value representing the serving number, and each ingredient line compute his amount. We are not reading and writing DOM anymore, we are just calculating interesting values when we have to, enjoying the reactivity of VueJs.</p><p>There is some cases where jQuery is shorted than Vuejs, but it’s easy to add true logic with Vuejs.</p><p>But now, if we want to use all the power of Vuejs and use components ?We can !</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FErilan%2Fembed%2Fpreview%2FRqbxEJ%3Fheight%3D600%26slug-hash%3DRqbxEJ%26default-tabs%3Dhtml%2Cresult%26host%3Dhttps%3A%2F%2Fcodepen.io&amp;url=https%3A%2F%2Fcodepen.io%2FErilan%2Fpen%2FRqbxEJ&amp;image=https%3A%2F%2Fs3-us-west-2.amazonaws.com%2Fi.cdpn.io%2F595217.RqbxEJ.small.dbb022f7-02db-4715-acd9-8eb9f37f248f.png&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/66533093748e09ce05d9397eb17e0175/href">https://medium.com/media/66533093748e09ce05d9397eb17e0175/href</a></iframe><p>We can create on the fly components, but writing html in a javascript string is often a bad idea, and not really reusable.</p><p>It’s time to go deeper with Webpack ! But it can be hard to use and configure, so we will use Webpack Encore (<a href="https://symfony.com/doc/current/frontend.html">https://symfony.com/doc/current/frontend.html</a>) which is a standalone Webpack wrapper created by SensioLab, the editor of Symfony.</p><p>We just have to install it, and some Vue related packages :</p><pre>composer require symfony/webpack-encore-pack<br>npm install — save node-sass sass-loader vue vue-loader vue-template-compiler</pre><p>In the generated file <em>webpack.config.js</em>, we have to enable the Vue loader :</p><pre>Encore<br>  // enables VueJs support<br>  .enableVueLoader()</pre><p>We can now create .vue files, and enjoy the strength of vue-template-loader :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/6dcac25a973340c6198193c7c8168ac2/href">https://medium.com/media/6dcac25a973340c6198193c7c8168ac2/href</a></iframe><p>To instantiate our vue, we simply add a div with a specific class and we handle mount in our javascript entry point :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/22619635121d1dd687a95413448e06d0/href">https://medium.com/media/22619635121d1dd687a95413448e06d0/href</a></iframe><p>It’s now time to go deeper and deeper !</p><p>Let’s see what I call the <strong>widget approach</strong>. I show integration widgets in a Symfony application in this example, but it can work with any other tool.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*9X4ZkelF5iOOUiAQ" /></figure><p>The idea is to compose pages as usual, rendered from server with static HTML, and to enhance it with some Vue parts, called <strong>Widgets</strong>. A widget can be unique, or reused. It can be independent, or linked with others with an event bus or a Vuex store.</p><p>With this approach, we need to be more rigorous. Here is a proposition of file architecture to handle our widgets, and Vue related files :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/299/0*RDTpSpkctPtNpPnh" /></figure><p>In our <em>js</em> directory, we have one folder for vue utilities, like mixins, plugins, directives, etc..</p><p>We have a <em>Widgets</em> folder, which contain all our widgets. Each widgets has his own directory, with the root vue, and their components. We can have a <em>Common </em>directory with common vues.</p><p>There is also a directory for the store, and one for others services, like api, eventBus, etc..</p><p>finally, we have our main Vue entrypoint : <strong>vueWidgetsHandler</strong>.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0602c0453ee6b1753a5453ce73ac7d32/href">https://medium.com/media/0602c0453ee6b1753a5453ce73ac7d32/href</a></iframe><p>This file is in charge of creating our widgets. It can be very generic, or fully customized.</p><p>For each of our widget, we are going to instantiate a Vue, with various options, like a store, a router, or props.</p><p>In this example, we use the DOM element <em>dataset</em> as values for props. It’s compliant with HTML and easy to use.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d84a42d70710a7386ffa25ac55856738/href">https://medium.com/media/d84a42d70710a7386ffa25ac55856738/href</a></iframe><p>With a good combination of widgets, you can build websites that look like an application ! You can find a real example here (the mobile version is better ;) ) : <a href="https://www.make-my-box.com/">www.make-my-box.com</a></p><p>This article is long enough, but there are a lot of possibilities to enhance this approach, by playing with Vuex store, or eventBus !</p><p>Finally, jQuery is well known, there is plenty of plugins and libraries that speed up your project, but using Vue is very fun, and give another way to enhance your website ! His approach is cleaner, simpler to maintain, and bring new features like native data binding !</p><blockquote>All the code and more is available here : <a href="https://github.com/Erilan/replace-jQuery-by-vuejs">https://github.com/Erilan/replace-jQuery-by-vuejs</a></blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ee6003ba323d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kaliop/how-to-use-vuejs-instead-of-jquery-ee6003ba323d">How to use VueJs instead of jQuery</a> was originally published in <a href="https://medium.com/kaliop">Kaliop</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Simple Authentication components strategy with VueJs]]></title>
            <link>https://medium.com/kaliop/simple-authentication-components-strategy-with-vuejs-acc8c93ef80a?source=rss-aed51be9c53------2</link>
            <guid isPermaLink="false">https://medium.com/p/acc8c93ef80a</guid>
            <category><![CDATA[vue]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[authentication]]></category>
            <category><![CDATA[vuejs]]></category>
            <dc:creator><![CDATA[Antonin Savoie]]></dc:creator>
            <pubDate>Mon, 17 Sep 2018 16:13:30 GMT</pubDate>
            <atom:updated>2019-11-18T14:16:34.091Z</atom:updated>
            <content:encoded><![CDATA[<p>I’m lead dev at Kaliop and today I speak about simple authentication components strategy with VueJs.</p><p>For the french version of this article, <a href="https://tech.kaliop.com/utiliser-vue-js-a-la-place-de-jquery/">click here</a>.</p><p>A lot of application are using authentication, and we use many variants to handle it properly. The component system of VueJs is powerful, so let’s use it to simply handle <strong>authentication process</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fjPWc9H3gNwr8JHAUrxlAw.png" /></figure><blockquote>It’s not always necessary to have a <strong>complex authentication</strong> <strong>system</strong>, a lot of applications has a simple need !</blockquote><p><em>Note : the code sample shown in this article will use </em><a href="https://cli.vuejs.org/guide/installation.html"><em>vue-cli</em></a><em> and </em><a href="https://router.vuejs.org/installation.html"><em>vue-router</em></a><em>. The code is available here : </em><a href="https://github.com/Erilan/auth-components-strategy-vuejs"><em>https://github.com/Erilan/auth-components-strategy-vuejs</em></a></p><p>We can restrict page access with navigation guards in vue-router, but sometime the need is really simple, and we can use only components to handle page accessing.</p><h3>A RESTRICTED PAGE</h3><p>Let’s say we have a page we want to protect, like a administration dashboard, an account page, or other things : a private page.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/9aed12d7b4d7b724f6c3a2addccec98e/href">https://medium.com/media/9aed12d7b4d7b724f6c3a2addccec98e/href</a></iframe><p>This page is really simple, but can make some api calls to display <strong>private information</strong>.</p><p>Now, let’s configure the vue-router to expose this page.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5b7d6fa15824136398fa3f286a739ed8/href">https://medium.com/media/5b7d6fa15824136398fa3f286a739ed8/href</a></iframe><p>If you go to the page <a href="http://localhost:8080/#/private-page">http://localhost:8080/#/private-page</a>, you will see the <strong>private content</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*UBD6EoPsUc6LT0SNBlt8bA.png" /></figure><h3>THE LOGIN PAGE</h3><p>We now have the restricted page, we want a login page. For our example, we are going to use a very simple login page.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8313498b9b13876e1d444a82af3a77ff/href">https://medium.com/media/8313498b9b13876e1d444a82af3a77ff/href</a></iframe><p>The login method is really simple : it just sends an event to the parent, but in real life cases, we have to make an api call, or check a cookie, or a vuex store… whatever will work.</p><h2>AUTHENTICATION COMPONENT STRATEGY</h2><p>And now, here is the <strong>authentication component strategy</strong> :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c9b28cb47aa454e56db1bfbea18e9b22/href">https://medium.com/media/c9b28cb47aa454e56db1bfbea18e9b22/href</a></iframe><p>Instead of having <strong>navigation guards</strong>, a <strong>redirection</strong>, or <strong>multiple components</strong> for each state of our user, we simply check if the user is logged in or not.</p><p>If the user is logged in, we display the page corresponding to the route, if not, we display the <strong>login component</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/350/1*jMczqDrXd76cLY25arco6g.gif" /></figure><p>In our example, when user logs in, the component App.vue knows that the user is logged in, and display the <strong>router-view</strong>, not the login page.</p><p>The system is really simple in this example, but instead of looking for the <strong><em>isLoggedIn</em></strong> data, we can read a cookie, look in a vuex store, make a api call, etc…</p><p>We can also improve this to have not restricted route, by using <a href="https://router.vuejs.org/guide/essentials/nested-routes.html">nested routes</a></p><p>And we can use Vue transition for a smoother switch between the login form and the restricted page</p><p>This solution is not the best, as it can’t handle all the cases, but for simple needs, it does the job !</p><p>Code can be found here : <a href="https://github.com/Erilan/auth-components-strategy-vuejs">https://github.com/Erilan/auth-components-strategy-vuejs</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acc8c93ef80a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/kaliop/simple-authentication-components-strategy-with-vuejs-acc8c93ef80a">Simple Authentication components strategy with VueJs</a> was originally published in <a href="https://medium.com/kaliop">Kaliop</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>