<?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: Manu The Blacker 🐊</title>
    <description>The latest articles on DEV Community by Manu The Blacker 🐊 (@manutheblacker).</description>
    <link>https://dev.to/manutheblacker</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%2F402136%2F5ded212d-f4f5-4481-9605-8ba55d213605.jpg</url>
      <title>DEV Community: Manu The Blacker 🐊</title>
      <link>https://dev.to/manutheblacker</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/manutheblacker"/>
    <language>en</language>
    <item>
      <title>How to build a modern Svelte apps using Routify and Django ?</title>
      <dc:creator>Manu The Blacker 🐊</dc:creator>
      <pubDate>Sun, 03 Mar 2024 05:17:05 +0000</pubDate>
      <link>https://dev.to/manutheblacker/how-to-build-a-modern-svelte-apps-using-routify-and-django--4l0g</link>
      <guid>https://dev.to/manutheblacker/how-to-build-a-modern-svelte-apps-using-routify-and-django--4l0g</guid>
      <description>&lt;p&gt;&lt;a href="https://svelte.io"&gt;Svelte&lt;/a&gt; is a frontend framework for JavaScript that makes it easy to build web apps with ease.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://routify.dev"&gt;Routify&lt;/a&gt; is a framework that adds support for SSR (Server-Side Rendering) to a Svelte project.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://djangoproject.com"&gt;Django&lt;/a&gt; is a framework for the Python language, allowing the construction of full-stack apps.&lt;/p&gt;

&lt;p&gt;I was working on a project that ran on Django, and up until now, I used static files to build my pages and vanilla JavaScript to animate elements on my page.&lt;/p&gt;

&lt;p&gt;The issue I encountered was that the Django server had to process/generate the complete HTML code of my page before displaying it, sometimes causing the page to take longer to load.&lt;/p&gt;

&lt;p&gt;In the end, I started some research to find a way to streamline my workflow. An API was built on the Django database to be used by other services throughout the project.&lt;/p&gt;

&lt;p&gt;The API was set up. Now, to consume it, there was no possibility of running an infrastructure on Netlify/Vercel because the project had to use files internal to the enterprise.&lt;/p&gt;

&lt;p&gt;Ultimately, I discovered &lt;a href="https://inertiajs.com/"&gt;Inertia.js&lt;/a&gt; who was used most to run ReactJS into server app ( Laravel/Django/Ruby ) without the need to run it as separate frontend.&lt;/p&gt;

&lt;p&gt;In the background, it was &lt;a href="https://github.com/MrBin99/django-vite"&gt;django_vite&lt;/a&gt; who were doing most of the work.&lt;/p&gt;

&lt;p&gt;My focus was on how to build a spa/ssr app to consume the API more easily.&lt;/p&gt;

&lt;p&gt;So, the first step was to install &lt;a href="https://github.com/MrBin99/django-vite"&gt;django_vite&lt;/a&gt; and then configure it. I'll share my &lt;code&gt;vite.config.js&lt;/code&gt; used to run Svelte.&lt;/p&gt;

&lt;p&gt;You can find below the configuration used in routify, django to make everything works great. &lt;/p&gt;

&lt;p&gt;Make sure to install Routify and in django enable a wildcard path so any request coming from your spa/ssr app is not detected as 404 page. &lt;/p&gt;

&lt;p&gt;Follow this post : &lt;a href="https://stackoverflow.com/questions/64883415/django-catching-all-urls-under-a-specific-name"&gt;https://stackoverflow.com/questions/64883415/django-catching-all-urls-under-a-specific-name&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After configuring it properly, make sure to run Vite in another window during development so that the files can be properly seen by the Django server.&lt;/p&gt;

&lt;p&gt;Once you are ready for production, run the following commands in this order:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm run build

python manage.py collectstatic 

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

&lt;/div&gt;



&lt;p&gt;Find the configuration files ( vite.config.js|settings.py ) here  : &lt;a href="https://gist.github.com/manutheblacker/b58f13d12476f0dae742be2a2a50e019"&gt;https://gist.github.com/manutheblacker/b58f13d12476f0dae742be2a2a50e019&lt;/a&gt;&lt;/p&gt;

</description>
    </item>
    <item>
      <title>How to generate a WP plugin based on React?</title>
      <dc:creator>Manu The Blacker 🐊</dc:creator>
      <pubDate>Mon, 20 Nov 2023 11:37:44 +0000</pubDate>
      <link>https://dev.to/manutheblacker/how-to-generate-a-wp-plugin-based-on-react-3og6</link>
      <guid>https://dev.to/manutheblacker/how-to-generate-a-wp-plugin-based-on-react-3og6</guid>
      <description>&lt;p&gt;WordPress (WP) stands out as the most widely used application on the internet. However, as a software engineer involved in constructing WP websites, we frequently encounter issues where certain plugins in the WP repository do not align accurately with their detailed descriptions.&lt;/p&gt;

&lt;p&gt;In such instances, the necessity arises to create custom plugins to fulfill specific goals. Our initial step is typically to seek resources that facilitate the initiation of our work and streamline the process of delivering results.&lt;/p&gt;

&lt;p&gt;This is where the online tool, &lt;a href="https://wppb.me"&gt;WPPB&lt;/a&gt;, comes into play. It simplifies the generation of boilerplate code for building WordPress plugins, addressing the challenges faced by developers in creating tailored solutions : &lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--sjxlzcO9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mh0dtcxwaxk77xiwzqtk.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--sjxlzcO9--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/mh0dtcxwaxk77xiwzqtk.png" alt="screenshot of wordpress plugin boilerplate" width="800" height="411"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After completing the initial setup, you have the freedom to incorporate additional resources or customize your plugin according to your preferences.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--Vy-LmIgk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1i4z218348y6ejecypfj.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--Vy-LmIgk--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/1i4z218348y6ejecypfj.png" alt="architecture of wppb plugin" width="800" height="953"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is the architecture of our folder, just below explained the various folders : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;admin:&lt;/strong&gt; This section houses all logic related to the WP dashboard.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;css:&lt;/strong&gt; Stores all CSS files related to the WP dashboard.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;js:&lt;/strong&gt; Stores all JavaScript files related to the WP dashboard.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;class-example-admin.php:&lt;/strong&gt; This is the main class of the plugin for the admin section.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;index.php:&lt;/strong&gt; This file prevents the folder from being browsable from the internet.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;includes:&lt;/strong&gt; This section contains the part of the plugin responsible for loading all plugin logic in the correct order and for the right hooks. (Learn more about hooks &lt;a href="https://developer.wordpress.org/plugins/hooks/"&gt;here&lt;/a&gt;)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;class-example-activator.php:&lt;/strong&gt; This class runs when the plugin is activated, suitable for tasks like creating SQL structures.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;class-example-deactivator.php:&lt;/strong&gt; This class runs when the plugin is deactivated, suitable for tasks like deleting SQL structures.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;class-example-i18n.php:&lt;/strong&gt; This class is responsible for the internalization of the plugin.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;class-example-loader.php:&lt;/strong&gt; This class rewrites the default &lt;code&gt;add_action&lt;/code&gt; and &lt;code&gt;add_filter&lt;/code&gt; functions of WordPress.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;class-example.php:&lt;/strong&gt; Loads the respective logic for the admin or the public.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;languages:&lt;/strong&gt; This is where the translations of the plugin in various languages are stored. You can use tools like Poedit or the Loco Translate plugin to facilitate this process.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;public:&lt;/strong&gt; This section contains the part of the plugin responsible for loading all plugin logic for the frontend.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;css:&lt;/strong&gt; Stores all CSS files related to the public-facing side.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;js:&lt;/strong&gt; Stores all JavaScript files related to the public-facing side.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;class-example-public.php:&lt;/strong&gt; This is the main class of the plugin for the frontend.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;index.php:&lt;/strong&gt; This file prevents the folder from being browsable from the internet.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;other files (such as example.php and readme.txt) serve as a starting point for loading the plugin configuration into WordPress.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We initially intended to continue working with our existing plugin. However, after attending the annual &lt;a href="https://www.youtube.com/@WordPress"&gt;World of Word&lt;/a&gt;, we recently discovered that the CMS is transitioning to become Gutenberg-based, built on top of ReactJS.&lt;/p&gt;

&lt;p&gt;ReactJS, being a web framework that simplifies the development of web applications more efficiently and in less time, presents an exciting opportunity. Combining these two worlds into a single plugin can significantly enhance our development process.&lt;/p&gt;

&lt;p&gt;The new goal is to evolve from the WPPB structure to create a generator capable of preparing a WordPress plugin for seamless integration with ReactJS.&lt;/p&gt;

&lt;p&gt;For this purpose, a new tool has been developed and named &lt;a href="https://wprb-generator.vercel.app"&gt;WPRB&lt;/a&gt;, which stands for WordPress React Boilerplate. It maintains the same architecture as WPPB but integrates the appropriate tools from a React background.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--NQ7pFgm---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62b3qe8kikgc0kj1rv1n.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--NQ7pFgm---/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/62b3qe8kikgc0kj1rv1n.png" alt="screenshot of wordpress plugin react boilerplate" width="800" height="436"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;You have the flexibility to include any NPM packages for the frontend in each section. Whether you prefer MaterialUI, Tailwind CSS, or any other, you just need to follow the same instructions and include it as if you were building a React app.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--UJCt3xFj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tsd8gm89ifeei8ioit8v.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--UJCt3xFj--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/tsd8gm89ifeei8ioit8v.png" alt="architecture of wprb plugin" width="800" height="1001"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I will generate a new plugin using WPRB. This updated version essentially follows the same architecture as WPPB, but it now includes initial configuration files to kickstart a React app within it. The architecture within the plugin is the following : &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;admin:&lt;/strong&gt; Stores all logic related to the WP dashboard.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;dist:&lt;/strong&gt; Output after building by webpack; it contains the CSS and JS that will be loaded.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;src:&lt;/strong&gt; Contains the source React code for the admin; you can use any of your favorite libraries here.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;class-example-admin.php:&lt;/strong&gt; The main class of the plugin for the admin section.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;index.php:&lt;/strong&gt; This file prevents the folder from being browsable from the internet.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;includes:&lt;/strong&gt; This section contains the part of the plugin responsible for loading all plugin logic in the correct order and for the right hooks. (Learn more about hooks here)&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;class-example-activator.php:&lt;/strong&gt; This class runs when the plugin is activated, suitable for tasks like creating any SQL structure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;class-example-deactivator.php:&lt;/strong&gt; This class runs when the plugin is deactivated, suitable for tasks like deleting any SQL structure.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;class-example-i18n.php:&lt;/strong&gt; This class is responsible for the internalization of the plugin.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;class-example-loader.php:&lt;/strong&gt; This class rewrites the default &lt;code&gt;add_action&lt;/code&gt; and &lt;code&gt;add_filter&lt;/code&gt; functions of WordPress.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;class-example.php:&lt;/strong&gt; Loads the respective logic for the admin or the public.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;languages:&lt;/strong&gt; This is where the translations of the plugin in various languages are stored. You can use tools like Poedit or the Loco Translate plugin to achieve this.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;

&lt;p&gt;&lt;strong&gt;public:&lt;/strong&gt; This section contains the part of the plugin responsible for loading all plugin logic for the frontend.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;dist:&lt;/strong&gt; Output after building by webpack; it contains the CSS and JS that will be loaded.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;src:&lt;/strong&gt; Contains the source React code for the public; you can use any of your favorite libraries here.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;class-example-admin.php:&lt;/strong&gt; The main class of the plugin for the admin section.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;index.php:&lt;/strong&gt; This file prevents the folder from being browsable from the internet.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;&lt;p&gt;other files (such as example.php and readme.txt) serve as a starting point for loading the plugin configuration into WordPress.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Once you've grasped the structure, simply run &lt;code&gt;yarn install&lt;/code&gt; or &lt;code&gt;npm install&lt;/code&gt; at the root of the plugin to install the necessary dependencies. After this step, you're ready to go.&lt;/p&gt;

&lt;p&gt;That's all for this explanation. If you're interested in enhancing or contributing to this work, feel free to fork this repository: &lt;a href="https://github.com/homescriptone/WordPress-Plugin-React-Boilerplate"&gt;https://github.com/homescriptone/WordPress-Plugin-React-Boilerplate&lt;/a&gt;. It contains the base code used to create and deliver these functionalities. Happy coding!&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>wordpress</category>
      <category>react</category>
      <category>javascript</category>
    </item>
    <item>
      <title>How to use online VS Code editor alongside your GitHub repo ?</title>
      <dc:creator>Manu The Blacker 🐊</dc:creator>
      <pubDate>Fri, 04 Aug 2023 11:42:07 +0000</pubDate>
      <link>https://dev.to/manutheblacker/how-to-use-online-vs-code-editor-alongside-your-github-repo--58l4</link>
      <guid>https://dev.to/manutheblacker/how-to-use-online-vs-code-editor-alongside-your-github-repo--58l4</guid>
      <description>&lt;p&gt;Do you know if you replace &lt;strong&gt;github.com&lt;/strong&gt; by &lt;strong&gt;github.dev&lt;/strong&gt; into your repo URL it opens VS Code into your browser ?&lt;/p&gt;

</description>
      <category>programming</category>
      <category>webdev</category>
      <category>productivity</category>
      <category>github</category>
    </item>
    <item>
      <title>Super</title>
      <dc:creator>Manu The Blacker 🐊</dc:creator>
      <pubDate>Thu, 04 Jun 2020 19:56:20 +0000</pubDate>
      <link>https://dev.to/manutheblacker/super-21in</link>
      <guid>https://dev.to/manutheblacker/super-21in</guid>
      <description>&lt;p&gt;Hello world&lt;/p&gt;

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