<?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: Muhamad Jamil</title>
    <description>The latest articles on DEV Community by Muhamad Jamil (@fanreza).</description>
    <link>https://dev.to/fanreza</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%2F845127%2F934ca78a-3b3f-409b-b93a-c301d7199f6f.png</url>
      <title>DEV Community: Muhamad Jamil</title>
      <link>https://dev.to/fanreza</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/fanreza"/>
    <language>en</language>
    <item>
      <title>Laravel vite install bootstrap</title>
      <dc:creator>Muhamad Jamil</dc:creator>
      <pubDate>Wed, 30 Nov 2022 03:10:46 +0000</pubDate>
      <link>https://dev.to/fanreza/laravel-vite-install-bootstrap-c1e</link>
      <guid>https://dev.to/fanreza/laravel-vite-install-bootstrap-c1e</guid>
      <description>&lt;h2&gt;
  
  
  Install package
&lt;/h2&gt;

&lt;p&gt;Ensure you have install &lt;code&gt;vite&lt;/code&gt; and &lt;code&gt;laravel-vite-plugin&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev vite laravel-vite-plugin
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;No need to do this if you make a new app since its included when you create laravel app&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;and then install bootstrap&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm install --save-dev sass bootstrap @popperjs/core
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Configure vite
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { defineConfig } from 'vite'
import laravel from 'laravel-vite-plugin'
import path from 'path'

export default defineConfig({
    plugins: [
        laravel([
            'resources/js/app.js',
        ]),
    ],
    resolve: {
        alias: {
            '~bootstrap': path.resolve(__dirname, 'node_modules/bootstrap'),
        }
    },
})
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;this allow vite to use bootstrap as an alias so we can use it on js and scss file&lt;/p&gt;

&lt;h2&gt;
  
  
  Import package
&lt;/h2&gt;

&lt;p&gt;Create a new file in your resource folder &lt;code&gt;app.scss&lt;/code&gt; and import it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="c1"&gt;// app.scss&lt;/span&gt;
&lt;span class="c1"&gt;// Import Bootstrap css&lt;/span&gt;
&lt;span class="k"&gt;@import&lt;/span&gt; &lt;span class="s2"&gt;"~bootstrap/scss/bootstrap"&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and last, import it to the &lt;code&gt;resources/js/app.js&lt;/code&gt; file or &lt;code&gt;resources/js/bootstrap.js&lt;/code&gt; file, laravel create those 2 file on the first time&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="c1"&gt;// app.js&lt;/span&gt;
&lt;span class="c1"&gt;// Import our CSS that included bootstrap css&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;../app.scss&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="c1"&gt;// Import bootstrap JS&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="k"&gt;as&lt;/span&gt; &lt;span class="nx"&gt;bootstrap&lt;/span&gt; &lt;span class="k"&gt;from&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;bootstrap&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and then load it in your blade template&lt;br&gt;
&lt;code&gt;@vite(['resources/js/app.js'])&lt;/code&gt; &lt;/p&gt;

&lt;p&gt;to run it&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npm run dev
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and laravel server&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight php"&gt;&lt;code&gt;&lt;span class="n"&gt;php&lt;/span&gt; &lt;span class="n"&gt;artisan&lt;/span&gt; &lt;span class="n"&gt;serve&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;em&gt;if you have error &lt;code&gt;vite is not recognize as a command or vite not found&lt;/code&gt;&lt;/em&gt; ensure you already install it, run &lt;code&gt;npm install&lt;/code&gt; after you create your first laravel app&lt;/p&gt;
&lt;/blockquote&gt;

&lt;h2&gt;
  
  
  Footnote
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://laravel.com/docs/9.x/vite#installing-vite-and-laravel-plugin" rel="noopener noreferrer"&gt;Laravel vite docs&lt;/a&gt;&lt;/p&gt;

</description>
      <category>emptystring</category>
    </item>
    <item>
      <title>Resolving problem with 2 csrf tokens in same domain laravel</title>
      <dc:creator>Muhamad Jamil</dc:creator>
      <pubDate>Thu, 13 Oct 2022 05:19:57 +0000</pubDate>
      <link>https://dev.to/fanreza/resolving-problem-with-2-csrf-tokens-in-same-domain-laravel-46e5</link>
      <guid>https://dev.to/fanreza/resolving-problem-with-2-csrf-tokens-in-same-domain-laravel-46e5</guid>
      <description>&lt;p&gt;if you have 2 apps on same domain like&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;https://somesite.com/someapp-1
https://somesite.com/someapp-2
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The CSRF token will competing each other, and it happen today in my office, the easy way to fix it is setting your &lt;code&gt;cookies.php&lt;/code&gt; file&lt;/p&gt;

&lt;p&gt;search some settings called path in &lt;code&gt;cookies.php&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    /*
    |--------------------------------------------------------------------------
    | Session Cookie Path
    |--------------------------------------------------------------------------
    |
    | The session cookie path determines the path for which the cookie will
    | be regarded as available. Typically, this will be the root path of
    | your application but you are free to change this when necessary.
    |
    */

    'path' =&amp;gt; '/',


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and change it to your app path like&lt;/p&gt;

&lt;p&gt;&lt;code&gt;'path' =&amp;gt; '/someapp-1/'&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;or you can use &lt;code&gt;.env&lt;/code&gt; too&lt;/p&gt;

&lt;p&gt;thanks for reading, also thanks for this stackoverflow questions&lt;/p&gt;

&lt;p&gt;&lt;a href="https://stackoverflow.com/questions/68468526/is-it-possible-to-rename-the-xsrf-token-cookie-that-laravel-is-creating"&gt;https://stackoverflow.com/questions/68468526/is-it-possible-to-rename-the-xsrf-token-cookie-that-laravel-is-creating&lt;/a&gt;&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>php</category>
      <category>webdev</category>
      <category>csrf</category>
    </item>
    <item>
      <title>Use .env files in vue vite</title>
      <dc:creator>Muhamad Jamil</dc:creator>
      <pubDate>Sat, 08 Oct 2022 09:32:27 +0000</pubDate>
      <link>https://dev.to/fanreza/use-env-files-in-vue-vite-363g</link>
      <guid>https://dev.to/fanreza/use-env-files-in-vue-vite-363g</guid>
      <description>&lt;p&gt;vite is a handy tools that provide many advantage, im very happy developing vue project with vite, thanks to &lt;a href="https://github.com/yyx990803"&gt;Evan You&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;lets get started,&lt;/p&gt;

&lt;p&gt;lets make some &lt;code&gt;.env&lt;/code&gt; files first in the root project and insert some key &lt;code&gt;SOME_VARIABLE = value&lt;/code&gt;, now how to access it? &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Vite exposes env variables on the special &lt;code&gt;import.meta.env&lt;/code&gt; object.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;as vite documentation said, we can access the env variable using &lt;code&gt;import.meta.env&lt;/code&gt; so we access with &lt;code&gt;import.meta.env.SOME_VARIABLE&lt;/code&gt;, lets do some console log&lt;/p&gt;

&lt;p&gt;&lt;code&gt;console.log(import.meta.env.SOME_VARIABLE) //undefined&lt;/code&gt;, why it undefined?&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;To prevent accidentally leaking env variables to the client, only variables prefixed with VITE_ are exposed to your Vite-processed code&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;vite only showing the variable with prefix &lt;code&gt;VITE_&lt;/code&gt;, its very nice to prevent leaked data to client, so change your key to &lt;code&gt;VITE_SOME_VARIABLE&lt;/code&gt;, now it can be viewed&lt;/p&gt;

&lt;p&gt;vite also support mode, if you change your &lt;code&gt;.env&lt;/code&gt; file into &lt;code&gt;.env.development&lt;/code&gt; that file only used in development mode&lt;/p&gt;

&lt;p&gt;and if you change to &lt;code&gt;.env.production&lt;/code&gt; it only used in production mode.&lt;/p&gt;

&lt;p&gt;thats all i know about using .env in vite, further reading &lt;a href="https://vitejs.dev/guide/env-and-mode.html"&gt;https://vitejs.dev/guide/env-and-mode.html&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Thanks for reading.&lt;/p&gt;

</description>
      <category>vue</category>
      <category>vite</category>
      <category>env</category>
      <category>javascript</category>
    </item>
    <item>
      <title>Deploying Vue apps in subdirectory</title>
      <dc:creator>Muhamad Jamil</dc:creator>
      <pubDate>Thu, 15 Sep 2022 09:20:05 +0000</pubDate>
      <link>https://dev.to/fanreza/resolving-problem-when-deploying-vue-apps-with-subfolder-2ba5</link>
      <guid>https://dev.to/fanreza/resolving-problem-when-deploying-vue-apps-with-subfolder-2ba5</guid>
      <description>&lt;p&gt;This take 6 hours for me to understand, &lt;/p&gt;

&lt;p&gt;first you need to configure some file&lt;br&gt;
&lt;code&gt;1. vite.config.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;import { fileURLToPath, URL } from "url";

import { defineConfig } from "vite";
import vue from "@vitejs/plugin-vue";

// https://vitejs.dev/config/
export default defineConfig({
    plugins: [vue()],
    base: "/yourSubdirectory/",
    resolve: {
        alias: {
            "@": fileURLToPath(new URL("./src", import.meta.url)),
        },
    },
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you need to add &lt;code&gt;base&lt;/code&gt; configuration in your vite config, to make your asset file path relative to the root and the subdirectory.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;2. index.js in router&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;    history: createWebHistory(`/subDirectory`),
    base: `/subDirectory`,
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;you need to add base configuration in the router so vue know where exactly your file, and the history to make vue save your subDirectory as a history route&lt;/p&gt;

&lt;p&gt;&lt;code&gt;3. .htaccess&lt;/code&gt;&lt;br&gt;
this is the game begin&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;IfModule mod_negotiation.c&amp;gt;
  Options -MultiViews
&amp;lt;/IfModule&amp;gt;

&amp;lt;IfModule mod_rewrite.c&amp;gt;
RewriteEngine On
RewriteBase /subDirectory
RewriteRule ^subDirectory/index\.html$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /subDirectory/index.html [L]
&amp;lt;/IfModule&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;i cannot explain this section, so if you guys know please explain to me, i really appreciate it.&lt;/p&gt;

&lt;p&gt;if you guys have same problem with me and have another method to resolve it, feel free to share.&lt;/p&gt;

&lt;p&gt;thanks for reading.&lt;/p&gt;

</description>
      <category>vue</category>
      <category>htaccess</category>
      <category>apache</category>
      <category>deployment</category>
    </item>
    <item>
      <title>Resolving problem when using Trix rich editor with tailwind</title>
      <dc:creator>Muhamad Jamil</dc:creator>
      <pubDate>Wed, 13 Jul 2022 07:21:31 +0000</pubDate>
      <link>https://dev.to/fanreza/resolving-problem-when-using-trix-rich-editor-with-tailwind-13ca</link>
      <guid>https://dev.to/fanreza/resolving-problem-when-using-trix-rich-editor-with-tailwind-13ca</guid>
      <description>&lt;p&gt;it takes so loong for me to realize that tailwind reset is overriding the trix style because trix using a html tag like heading or list, and those tag style has been reset with tailwind.&lt;/p&gt;

&lt;p&gt;Btw what i do is make my own style to give back the default style especially for heading and list tag.&lt;/p&gt;

&lt;p&gt;so in my index.css, i added this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* Tailwind Override */
.trix-editor {
    width: 100%;
}

.trix-editor h1 {
    font-size: 1.25rem !important;
    line-height: 1.25rem !important;
    margin-bottom: 1rem;
    font-weight: 600;
}

.trix-editor a:not(.no-underline) {
    text-decoration: underline;
}

.trix-editor a:visited {
    color: green;
}

.trix-editor ul {
    list-style-type: disc;
    padding-left: 1rem;
}

.trix-editor ol {
    list-style-type: decimal;
    padding-left: 1rem;
}

.trix-editor pre {
    display: inline-block;
    width: 100%;
    vertical-align: top;
    font-family: monospace;
    font-size: 1.5em;
    padding: 0.5em;
    white-space: pre;
    background-color: #eee;
    overflow-x: auto;
}

.trix-editor blockquote {
    border: 0 solid #ccc;
    border-left-width: 0px;
    border-left-width: 0.3em;
    margin-left: 0.3em;
    padding-left: 0.6em;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and add &lt;code&gt;trix-editor&lt;/code&gt; class to &lt;code&gt;trix-editor&lt;/code&gt; tag&lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;trix-editor input="x" class="trix-editor"&amp;gt;&amp;lt;/trix-editor&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and many thanks for this github &lt;a href="https://github.com/tailwindlabs/tailwindcss/issues/989"&gt;issue&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="//trix-editor.org/"&gt;Trix Editor&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;thanks for reading&lt;/p&gt;

</description>
      <category>tailwindcss</category>
      <category>trix</category>
    </item>
    <item>
      <title>Preview vue.js app in android</title>
      <dc:creator>Muhamad Jamil</dc:creator>
      <pubDate>Mon, 11 Jul 2022 03:10:35 +0000</pubDate>
      <link>https://dev.to/fanreza/preview-vuejs-app-in-android-26hl</link>
      <guid>https://dev.to/fanreza/preview-vuejs-app-in-android-26hl</guid>
      <description>&lt;p&gt;First you need to ensure that your device is in same network&lt;/p&gt;

&lt;p&gt;in &lt;code&gt;package.json&lt;/code&gt; file in your app, add this command&lt;/p&gt;

&lt;p&gt;&lt;code&gt;"host": "vite --host"&lt;/code&gt; or use your own name, im using &lt;code&gt;host&lt;/code&gt; for command name. you can change the setting inside &lt;code&gt;vite.config.js&lt;/code&gt; too with this setting&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;  server: {
    host: true
  }
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;vite will automatically use your ip as a server ip, then run the command with &lt;code&gt;npm run host&lt;/code&gt;, and finally you can access your app in external device, just access it with &lt;code&gt;{your ip}:{your app port}&lt;/code&gt; eg: &lt;code&gt;192.168.10.1:3000&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;Thanks for this github &lt;a href="https://github.com/vitejs/vite/discussions/3396"&gt;issue&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;if you have another method feel free to discuss, thanks for reading&lt;/p&gt;

</description>
      <category>vue</category>
      <category>vite</category>
      <category>mobile</category>
      <category>android</category>
    </item>
    <item>
      <title>Eager load for getting role name in spatie/permissions</title>
      <dc:creator>Muhamad Jamil</dc:creator>
      <pubDate>Thu, 07 Jul 2022 04:25:20 +0000</pubDate>
      <link>https://dev.to/fanreza/eager-load-for-getting-role-name-in-spatiepermissions-2b95</link>
      <guid>https://dev.to/fanreza/eager-load-for-getting-role-name-in-spatiepermissions-2b95</guid>
      <description>&lt;p&gt;at first im using this method to show role name in blade view&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;        &amp;lt;td&amp;gt;
        @if(!empty($user-&amp;gt;getRoleNames()))
            @foreach($user-&amp;gt;getRoleNames() as $role)
                &amp;lt;label class="badge bg-primary"&amp;gt;{{ $role }}&amp;lt;/label&amp;gt;
            @endforeach
        @endif
        &amp;lt;/td&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;but when i see in clockwork, there are many query from role, yes its a n+1 problem&lt;/p&gt;

&lt;p&gt;so i use eager load for this&lt;/p&gt;

&lt;p&gt;in &lt;strong&gt;UserController&lt;/strong&gt; i added this&lt;br&gt;
&lt;code&gt;$data = User::with(['roles']);&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;so when i query User table, roles table will join it&lt;/p&gt;

&lt;p&gt;and in blade view i added this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@if(!empty($user-&amp;gt;roles))
            @foreach($user-&amp;gt;roles as $role)
                &amp;lt;label class="badge bg-primary"&amp;gt;{{ $role-&amp;gt;name }}&amp;lt;/label&amp;gt;
            @endforeach
        @endif
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if you have another way, feel free to discuss&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>backend</category>
      <category>laravel</category>
      <category>spatie</category>
    </item>
    <item>
      <title>generate unique slug with eloquent-sluggable package laravel 8</title>
      <dc:creator>Muhamad Jamil</dc:creator>
      <pubDate>Sun, 03 Jul 2022 13:19:10 +0000</pubDate>
      <link>https://dev.to/fanreza/generate-unique-slug-with-eloquent-sluggable-package-laravel-8-2pi9</link>
      <guid>https://dev.to/fanreza/generate-unique-slug-with-eloquent-sluggable-package-laravel-8-2pi9</guid>
      <description>&lt;p&gt;First install the package with composer &lt;code&gt;composer require cviebrock/eloquent-sluggable&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and simply put this code in your model&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;use Cviebrock\EloquentSluggable\Sluggable;

class Post extends Model
{
    use Sluggable;
    public function sluggable(): array
    {
        return [
            'slug' =&amp;gt; [
                'source' =&amp;gt; 'title'
            ]
        ];
    }
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;it will automatically use title as a slug&lt;/p&gt;

&lt;p&gt;for more feature, maybe you want to read the &lt;a href="https://github.com/cviebrock/eloquent-sluggable"&gt;documentations&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;thanks for reading, if you have a better method, feel free to discuss&lt;/p&gt;

</description>
      <category>laravel</category>
      <category>slug</category>
      <category>php</category>
      <category>webdev</category>
    </item>
    <item>
      <title>My first time using docker for deploying static website</title>
      <dc:creator>Muhamad Jamil</dc:creator>
      <pubDate>Thu, 09 Jun 2022 03:38:47 +0000</pubDate>
      <link>https://dev.to/fanreza/my-first-time-using-docker-for-deploying-static-website-1cm9</link>
      <guid>https://dev.to/fanreza/my-first-time-using-docker-for-deploying-static-website-1cm9</guid>
      <description>&lt;p&gt;im using &lt;strong&gt;AWS EC2&lt;/strong&gt; for VPS, &lt;strong&gt;Ubuntu 20.04&lt;/strong&gt; for operating system, and &lt;strong&gt;nginx&lt;/strong&gt; as a web server.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;First we need to install the docker&lt;/strong&gt;&lt;br&gt;
maybe you want to read more in their &lt;a href="https://docs.docker.com/engine/install/"&gt;documentation&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;or using my method, step by step install docker&lt;/p&gt;

&lt;p&gt;login as root&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;apt -y update&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;apt -y install apt-transport-https ca-certificates curl gnupg-agent software-properties-common&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;'curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;apt-key fingerprint 0EBFCD88&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable"&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;apt -y update&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;apt -y install docker-ce docker-ce-cli containerd.io&lt;/code&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;and for checking the docker running&lt;br&gt;
&lt;code&gt;systemctl status docker&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;after the docker installation, choose your static website that you want to deploy.&lt;/p&gt;

&lt;p&gt;after that, create a &lt;code&gt;Dockerfile&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;nano Dockerfile&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;inside the &lt;code&gt;Dockerfile&lt;/code&gt; type this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;# Choose the image
FROM nginx
# Remove the default file
RUN rm -rf /usr/share/nginx/html/*
# Copy and move your own website file to the nginx html folder
COPY ./{your directory website} /usr/share/nginx/html
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;its time to build your image&lt;br&gt;
&lt;code&gt;docker build -t {image name} .&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;for example &lt;br&gt;
&lt;code&gt;docker build -t theia .&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and to check if your image build success&lt;br&gt;
&lt;code&gt;docker images&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;REPOSITORY   TAG       IMAGE ID       CREATED          SIZE
theia        latest    b8b7870c8621   24 minutes ago   143MB
nginx        latest    0e901e68141f   11 days ago      142MB
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;if you see your docker image, now were gonna run it&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker run -d(for running in background) -p 8080:80(choose your not used port) --name(name your container) (your image)&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;for example&lt;/p&gt;

&lt;p&gt;&lt;code&gt;docker run -d -p 8080:80 --name thalia theia&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;and finally you can access your website using your public ip and port&lt;/p&gt;

&lt;p&gt;example mine is &lt;code&gt;54.183.74.95:8080&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;if you have another method, feel free to discuss.&lt;br&gt;
thanks for reading, have a nice day&lt;/p&gt;

</description>
      <category>docker</category>
      <category>nginx</category>
      <category>ubuntu</category>
      <category>devops</category>
    </item>
    <item>
      <title>Using boxicons in Vue app, installing with npm</title>
      <dc:creator>Muhamad Jamil</dc:creator>
      <pubDate>Tue, 07 Jun 2022 21:40:05 +0000</pubDate>
      <link>https://dev.to/fanreza/using-boxicons-in-vue-app-installing-with-npm-3elg</link>
      <guid>https://dev.to/fanreza/using-boxicons-in-vue-app-installing-with-npm-3elg</guid>
      <description>&lt;ol&gt;
&lt;li&gt;&lt;p&gt;install the boxicons using npm&lt;br&gt;
&lt;code&gt;npm install boxicons --save&lt;/code&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;if you want to use it as a font, you need to import it in your &lt;code&gt;main.js&lt;/code&gt; file, thanks to this &lt;a href="https://github.com/lusaxweb/vuesax-next/issues/110#issuecomment-734065844"&gt;github issue&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;use it as a font &lt;code&gt;import "boxicons/css/boxicons.min.css";&lt;/code&gt;&lt;br&gt;
use it as a web-component &lt;code&gt;import "boxicons/dist/boxicons.js";&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;for usage, checkout the documentation &lt;a href="https://boxicons.com/usage"&gt;https://boxicons.com/usage&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;if you have another way to use it, feel free to discuss&lt;/p&gt;

&lt;p&gt;thanks for reading&lt;/p&gt;

</description>
      <category>boxicons</category>
      <category>vue</category>
      <category>npm</category>
      <category>icon</category>
    </item>
    <item>
      <title>Resolving problem with vue tailwind and postcss nesting</title>
      <dc:creator>Muhamad Jamil</dc:creator>
      <pubDate>Mon, 30 May 2022 06:02:32 +0000</pubDate>
      <link>https://dev.to/fanreza/resolving-problem-with-vue-tailwind-and-postcss-nesting-4nha</link>
      <guid>https://dev.to/fanreza/resolving-problem-with-vue-tailwind-and-postcss-nesting-4nha</guid>
      <description>&lt;p&gt;Previously I made an application with vue js and tailwind&lt;/p&gt;

&lt;p&gt;because i'm used to using nesting feature in sass, i want to use it again in tailwind&lt;/p&gt;

&lt;p&gt;quite simple, I just need to add the &lt;code&gt;tailwindcss/nesting&lt;/code&gt;&lt;br&gt;
plugin to &lt;code&gt;postcss.config.js&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://tailwindcss.com/docs/using-with-preprocessors#nesting"&gt;Read More&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;here my &lt;code&gt;postcss.config.js&lt;/code&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;module.exports = {
  plugins: {
    'postcss-import': {},
    'tailwindcss/nesting': {},
    tailwindcss: {},
    autoprefixer: {},
  },
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;everything was working fine until i found that vscode reads &lt;code&gt;nesting&lt;/code&gt; and &lt;code&gt;@apply&lt;/code&gt; as error&lt;/p&gt;

&lt;p&gt;After hours of searching for an answer I can finally draw a conclusion.&lt;/p&gt;

&lt;p&gt;first i need to change the lang style in vue to postcss, &lt;br&gt;
&lt;code&gt;&amp;lt;style lang="postcss"&amp;gt;&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;the error warning is gone, but the syntax highlighting is not showing, after reading the same problem on github &lt;a href="https://github.com/johnsoncodehk/volar/issues/765"&gt;https://github.com/johnsoncodehk/volar/issues/765&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;and after read this comment&lt;br&gt;
&lt;a href="https://github.com/johnsoncodehk/volar/issues/765#issuecomment-989442125"&gt;https://github.com/johnsoncodehk/volar/issues/765#issuecomment-989442125&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;i replaced the postcss extension with &lt;a href="https://marketplace.visualstudio.com/items?itemName=cpylua.language-postcss"&gt;https://marketplace.visualstudio.com/items?itemName=cpylua.language-postcss&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;All done, error warning gone and the syntax highlighting comeback&lt;/p&gt;

&lt;p&gt;if you guys have the same problem and have another method to solve, feel free to share&lt;/p&gt;

&lt;p&gt;thanks for reading&lt;/p&gt;

</description>
      <category>vue</category>
      <category>volar</category>
      <category>tailwindcss</category>
      <category>postcss</category>
    </item>
    <item>
      <title>Should we delete some content if in mobile device?</title>
      <dc:creator>Muhamad Jamil</dc:creator>
      <pubDate>Sun, 29 May 2022 16:21:52 +0000</pubDate>
      <link>https://dev.to/fanreza/should-we-delete-some-content-if-in-mobile-device-4l19</link>
      <guid>https://dev.to/fanreza/should-we-delete-some-content-if-in-mobile-device-4l19</guid>
      <description>&lt;p&gt;Previously I found a registration page design, and tried to make it in the form of a website&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--JMx6kVOh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/epxva509nn8r26x9cev0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--JMx6kVOh--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/epxva509nn8r26x9cev0.png" alt="Image description" width="800" height="600"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;source: &lt;a href="https://dribbble.com/shots/15252242-Sign-Up-Page/attachments/7002202?mode=media"&gt;https://dribbble.com/shots/15252242-Sign-Up-Page/attachments/7002202?mode=media&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;but when in mobile device mode, I'm confused about whether I need content such as images or just adding a registration form and deleting the image&lt;/p&gt;

&lt;p&gt;please give me some advice&lt;br&gt;
would be love to start a discussion&lt;/p&gt;

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