<?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 Egor Talantsev on Medium]]></title>
        <description><![CDATA[Stories by Egor Talantsev on Medium]]></description>
        <link>https://medium.com/@iSpyric?source=rss-4db56ed89f2c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*K25R6EYYDSFwJGHU.jpg</url>
            <title>Stories by Egor Talantsev on Medium</title>
            <link>https://medium.com/@iSpyric?source=rss-4db56ed89f2c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Mon, 23 Nov 2026 02:57:07 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@iSpyric/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[CSS-Framework independent markup with VueJS]]></title>
            <link>https://medium.com/@iSpyric/css-framework-independent-markup-with-vuejs-cbe4277aac39?source=rss-4db56ed89f2c------2</link>
            <guid isPermaLink="false">https://medium.com/p/cbe4277aac39</guid>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[vuejs]]></category>
            <category><![CDATA[web-components]]></category>
            <dc:creator><![CDATA[Egor Talantsev]]></dc:creator>
            <pubDate>Thu, 22 Dec 2016 07:39:32 GMT</pubDate>
            <atom:updated>2016-12-22T07:39:32.716Z</atom:updated>
            <content:encoded><![CDATA[<p>Some developers meet with tasks like:</p><ul><li>We need to add a modal window to some page</li><li>We need to place a box with the title and the footer to some page</li><li>We need to add some card with image, title and brief information</li></ul><p>But different projects can use different CSS frameworks that required different markup and different js to call and doing simple tasks start with reading documentation.</p><p>And one day I started to think how to make some elements reusable and framework independent and found a quick solution. We can use VueJS! Let me show an example.</p><p>Here you can see how we need to define modal window on <a href="http://getbootstrap.com/">Twitter bootstrap</a></p><pre>&lt;div class=&quot;modal fade&quot; tabindex=&quot;-1&quot; role=&quot;dialog&quot;&gt;<br>  &lt;div class=&quot;modal-dialog&quot; role=&quot;document&quot;&gt;<br>    &lt;div class=&quot;modal-content&quot;&gt;<br>      &lt;div class=&quot;modal-header&quot;&gt;<br>        &lt;button type=&quot;button&quot; class=&quot;close&quot; data-dismiss=&quot;modal&quot; aria-label=&quot;Close&quot;&gt;&lt;span aria-hidden=&quot;true&quot;&gt;&amp;times;&lt;/span&gt;&lt;/button&gt;<br>        &lt;h4 class=&quot;modal-title&quot;&gt;Modal title&lt;/h4&gt;<br>      &lt;/div&gt;<br>      &lt;div class=&quot;modal-body&quot;&gt;<br>        &lt;p&gt;One fine body&amp;hellip;&lt;/p&gt;<br>      &lt;/div&gt;<br>      &lt;div class=&quot;modal-footer&quot;&gt;<br>        &lt;button type=&quot;button&quot; class=&quot;btn btn-default&quot; data-dismiss=&quot;modal&quot;&gt;Close&lt;/button&gt;<br>        &lt;button type=&quot;button&quot; class=&quot;btn btn-primary&quot;&gt;Save changes&lt;/button&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;</pre><p>And here you can see an example how to define modals with <a href="http://bulma.io/">Bulma</a></p><pre>&lt;div class=&quot;modal&quot;&gt;<br>  &lt;div class=&quot;modal-background&quot;&gt;&lt;/div&gt;<br>  &lt;div class=&quot;modal-card&quot;&gt;<br>    &lt;header class=&quot;modal-card-head&quot;&gt;<br>      &lt;p class=&quot;modal-card-title&quot;&gt;Modal title&lt;/p&gt;<br>      &lt;button class=&quot;delete&quot;&gt;&lt;/button&gt;<br>    &lt;/header&gt;<br>    &lt;section class=&quot;modal-card-body&quot;&gt;<br>        One fine body&amp;hellip;<br>    &lt;/section&gt;<br>    &lt;footer class=&quot;modal-card-foot&quot;&gt;<br>      &lt;a class=&quot;button is-primary&quot;&gt;Save changes&lt;/a&gt;<br>      &lt;a class=&quot;button&quot;&gt;Cancel&lt;/a&gt;<br>    &lt;/footer&gt;<br>  &lt;/div&gt;<br>&lt;/div&gt;</pre><p>As you can see we want to do the same thing but with different frameworks. The markup for it is completely different. In my opinion that’s bad. I think better way is to write something like:</p><pre>&lt;modal&gt;<br>    &lt;tempalte slot=&quot;header&quot;&gt;Modal title&lt;/template&gt;<br>    <br>    One fine body&amp;hellip;<br>    <br>    &lt;template slot=&quot;footer&quot;&gt;<br>        &lt;button type=&quot;button&quot; class=&quot;btn btn-default&quot; data-dismiss=&quot;modal&quot;&gt;Close&lt;/button&gt;<br>        &lt;button type=&quot;button&quot; class=&quot;btn btn-primary&quot;&gt;Save changes&lt;/button&gt;<br>    &lt;/template&gt;<br>&lt;/modal&gt;</pre><p>It’s more expressive way to define components because:</p><ul><li><strong>Markup become more informative. </strong>You don’t think what this div do, you just look at the tag and understand: Ok, it’s modal.</li><li><strong>Framework free markup</strong>. You don’t depend on the framework. If you decide to change design of modals in your application you just need to change one place.</li></ul><p>Ok, let’s look how to make it work in live application. Firstly, we need to define Vue component.</p><pre>Vue.component(&#39;modal&#39;, {<br>    props: {<br>        id: {<br>            required: true,<br>            type: String<br>        }<br>    },</pre><pre>template: `<br>        &lt;div class=&quot;modal&quot; :id=&quot;id&quot; tabindex=&quot;-1&quot; role=&quot;dialog&quot;  aria-hidden=&quot;true&quot;&gt;<br>            &lt;div class=&quot;modal-dialog&quot;&gt;<br>                &lt;div class=&quot;modal-content&quot;&gt;<br>                    &lt;div class=&quot;modal-header&quot;  <br>                         v-if=&quot;this.$slots[&#39;header&#39;]&quot;<br>                    &gt;<br>                        &lt;button type=&quot;button&quot; class=&quot;close&quot; <br>                                data-dismiss=&quot;modal&quot;<br>                        &gt;<br>                            &lt;span aria-hidden=&quot;true&quot;&gt;&amp;times;&lt;/span&gt;<br>                            &lt;span class=&quot;sr-only&quot;&gt;Close&lt;/span&gt;<br>                        &lt;/button&gt;<br>                        <br>                        &lt;slot name=&quot;header&quot;&gt;&lt;/slot&gt;<br>                    &lt;/div&gt;</pre><pre>                    &lt;div class=&quot;modal-body&quot;&gt;<br>                        &lt;slot&gt;&lt;/slot&gt;<br>                    &lt;/div&gt;</pre><pre>                    &lt;div class=&quot;modal-footer&quot; <br>                         v-if=&quot;this.$slots[&#39;footer&#39;]&quot;<br>                    &gt;<br>                        &lt;slot name=&quot;footer&quot;&gt;&lt;/slot&gt;<br>                    &lt;/div&gt;<br>                &lt;/div&gt;<br>            &lt;/div&gt;<br>        &lt;/div&gt;<br>    `<br>});</pre><p>And that’s all! You don’t need to do something more to create your custom component.</p><p>I added additional check for existence of header and footer slots at the sample above, so if you don’t provide some slot, it will not display with empty space.</p><p>So look at the modal markup again. Now it doesn’t contain any framework related thing so it can migrate to any project and all that you need to define component only once per project. If you work with the same framework in all your projects you can just make a package with Vue components for it and then just import it to your projects.</p><p>So let’s sum up:</p><ul><li>Vue components give you ability to make semantic markup</li><li>Vue components is reusable and easy-to-change feature</li><li>You can add some business logic to any component</li><li>Even more you can inject your styles to the component and keep all related to component in one place</li></ul><p><strong>If you have any questions you can touch me via </strong><a href="https://twitter.com/iSpyric"><strong>Twitter</strong></a></p><h4>If you find this article useful or interesting for you, please click the ❤ below so others can find it too. <strong>If you want to see more tutorials about Vue and Laravel, please click Follow after my name</strong></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=cbe4277aac39" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>