<?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: ramoures</title>
    <description>The latest articles on DEV Community by ramoures (@ramoures).</description>
    <link>https://dev.to/ramoures</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%2F1014467%2F1321c380-8cf2-4942-a39b-77bc999c7c16.jpeg</url>
      <title>DEV Community: ramoures</title>
      <link>https://dev.to/ramoures</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ramoures"/>
    <language>en</language>
    <item>
      <title>[Boost]</title>
      <dc:creator>ramoures</dc:creator>
      <pubDate>Thu, 20 Feb 2025 02:27:47 +0000</pubDate>
      <link>https://dev.to/ramoures/-272b</link>
      <guid>https://dev.to/ramoures/-272b</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/ramoures" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1014467%2F1321c380-8cf2-4942-a39b-77bc999c7c16.jpeg" alt="ramoures"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/ramoures/lightweight-and-flexible-minifier-js-css-html-597k" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Lightweight and Flexible Minifier (JS, CSS, HTML)&lt;/h2&gt;
      &lt;h3&gt;ramoures ・ Feb 19&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#css&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#html&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#minifier&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>javascript</category>
      <category>css</category>
      <category>html</category>
      <category>minifier</category>
    </item>
    <item>
      <title>live file-watching compressor for JavaScript, CSS, HTML files of your projects.</title>
      <dc:creator>ramoures</dc:creator>
      <pubDate>Wed, 19 Feb 2025 22:16:49 +0000</pubDate>
      <link>https://dev.to/ramoures/live-file-watching-compressor-for-javascript-css-html-files-of-your-projects-ieg</link>
      <guid>https://dev.to/ramoures/live-file-watching-compressor-for-javascript-css-html-files-of-your-projects-ieg</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/ramoures" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1014467%2F1321c380-8cf2-4942-a39b-77bc999c7c16.jpeg" alt="ramoures"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/ramoures/lightweight-and-flexible-minifier-js-css-html-597k" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Lightweight and Flexible Minifier (JS, CSS, HTML)&lt;/h2&gt;
      &lt;h3&gt;ramoures ・ Feb 19&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#css&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#html&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#minifier&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>javascript</category>
      <category>css</category>
      <category>html</category>
      <category>minifier</category>
    </item>
    <item>
      <title>live file-watching compressor for JavaScript, CSS, HTML files of your projects.</title>
      <dc:creator>ramoures</dc:creator>
      <pubDate>Wed, 19 Feb 2025 21:58:53 +0000</pubDate>
      <link>https://dev.to/ramoures/live-file-watching-compressor-for-javascript-css-html-files-of-your-projects-2okn</link>
      <guid>https://dev.to/ramoures/live-file-watching-compressor-for-javascript-css-html-files-of-your-projects-2okn</guid>
      <description>&lt;div class="ltag__link"&gt;
  &lt;a href="/ramoures" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__pic"&gt;
      &lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1014467%2F1321c380-8cf2-4942-a39b-77bc999c7c16.jpeg" alt="ramoures"&gt;
    &lt;/div&gt;
  &lt;/a&gt;
  &lt;a href="https://dev.to/ramoures/lightweight-and-flexible-minifier-js-css-html-597k" class="ltag__link__link"&gt;
    &lt;div class="ltag__link__content"&gt;
      &lt;h2&gt;Lightweight and Flexible Minifier (JS, CSS, HTML)&lt;/h2&gt;
      &lt;h3&gt;ramoures ・ Feb 19&lt;/h3&gt;
      &lt;div class="ltag__link__taglist"&gt;
        &lt;span class="ltag__link__tag"&gt;#javascript&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#css&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#html&lt;/span&gt;
        &lt;span class="ltag__link__tag"&gt;#minifier&lt;/span&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/a&gt;
&lt;/div&gt;


</description>
      <category>javascript</category>
      <category>css</category>
      <category>html</category>
      <category>minifier</category>
    </item>
    <item>
      <title>Lightweight and Flexible Minifier (JS, CSS, HTML)</title>
      <dc:creator>ramoures</dc:creator>
      <pubDate>Wed, 19 Feb 2025 12:55:45 +0000</pubDate>
      <link>https://dev.to/ramoures/lightweight-and-flexible-minifier-js-css-html-597k</link>
      <guid>https://dev.to/ramoures/lightweight-and-flexible-minifier-js-css-html-597k</guid>
      <description>&lt;p&gt;
    &lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Framoures%2Fminifix%2Fraw%2Fmain%2Fminifix.svg" class="article-body-image-wrapper"&gt;&lt;img alt="minifix" src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fgithub.com%2Framoures%2Fminifix%2Fraw%2Fmain%2Fminifix.svg" width="190" height="65"&gt;&lt;/a&gt;
&lt;/p&gt;

&lt;h3&gt;
  
  
  What is &lt;strong&gt;minifix&lt;/strong&gt;?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;minifix&lt;/strong&gt; is a universal minifier that supports minification for &lt;strong&gt;JavaScript&lt;/strong&gt;, &lt;strong&gt;CSS&lt;/strong&gt;, and &lt;strong&gt;HTML&lt;/strong&gt; files. It’s designed to be lightweight, easy to use, and highly configurable, making it a great tool for developers who want to optimize their code with minimal effort.&lt;/p&gt;

&lt;h2&gt;
  
  
  Features
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Efficient Minification&lt;/strong&gt;: &lt;strong&gt;minifix&lt;/strong&gt; uses powerful libraries like &lt;a href="https://terser.org/" rel="noopener noreferrer"&gt;&lt;em&gt;Terser&lt;/em&gt;&lt;/a&gt; for JavaScript, &lt;a href="https://github.com/clean-css/" rel="noopener noreferrer"&gt;&lt;em&gt;clean-css&lt;/em&gt;&lt;/a&gt; for CSS, and &lt;a href="https://github.com/terser/html-minifier-terser" rel="noopener noreferrer"&gt;&lt;em&gt;html-minifier-terser&lt;/em&gt;&lt;/a&gt; for HTML to ensure that your code is minified efficiently.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Live File Watching&lt;/strong&gt;: With live &lt;strong&gt;file-watching&lt;/strong&gt; support, minifix automatically detects changes in your files and minifies them instantly, eliminating the need for manual execution.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Configurable Options&lt;/strong&gt;: You can customize the minification process for each file type using a simple configuration file. &lt;strong&gt;minifix&lt;/strong&gt; leverages the power of three popular libraries, and you can fine-tune their behavior through the &lt;strong&gt;minifyOptions&lt;/strong&gt; configuration:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;CSS&lt;/strong&gt;: Configure options using &lt;a href="https://github.com/clean-css/clean-css#constructor-options" rel="noopener noreferrer"&gt;&lt;em&gt;clean-css&lt;/em&gt; constructor options&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;JavaScript&lt;/strong&gt;: Customize minification with &lt;a href="https://terser.org/docs/options/" rel="noopener noreferrer"&gt;&lt;em&gt;Terser&lt;/em&gt; options&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTML&lt;/strong&gt;: Adjust settings via &lt;a href="https://github.com/terser/html-minifier-terser#options-quick-reference" rel="noopener noreferrer"&gt;&lt;em&gt;html-minifier-terser&lt;/em&gt; options&lt;/a&gt;.&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;

&lt;li&gt;&lt;p&gt;&lt;strong&gt;Lightweight and Easy to Use&lt;/strong&gt;: &lt;strong&gt;minifix&lt;/strong&gt; is designed to be simple and straightforward, making it accessible for developers of all skill levels.&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;




&lt;p&gt;You can install it &lt;strong&gt;locally&lt;/strong&gt; or &lt;strong&gt;globally&lt;/strong&gt; using npm.&lt;/p&gt;

&lt;h1&gt;
  
  
  Installation
&lt;/h1&gt;

&lt;p&gt;Before installing &lt;strong&gt;minifix&lt;/strong&gt;, consider whether you need a &lt;strong&gt;local&lt;/strong&gt; or &lt;strong&gt;global&lt;/strong&gt; installation:  &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;strong&gt;local installation&lt;/strong&gt; is recommended for project-specific usage, ensuring that each project uses the correct version of &lt;strong&gt;minifix&lt;/strong&gt;.
&lt;/li&gt;
&lt;li&gt;A &lt;strong&gt;global installation&lt;/strong&gt; allows you to use &lt;strong&gt;minifix&lt;/strong&gt; across multiple projects system-wide without reinstalling it.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Local Installation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--save-dev&lt;/span&gt; minifix
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Global Installation
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;npm &lt;span class="nb"&gt;install&lt;/span&gt; &lt;span class="nt"&gt;--global&lt;/span&gt; minifix
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h1&gt;
  
  
  Usage
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Running Locally
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;npx minifix
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  Running Globally
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;minifix
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;📌 If &lt;code&gt;minifix.config.mjs&lt;/code&gt; does not exist, it will be created automatically.&lt;/p&gt;

&lt;h1&gt;
  
  
  Configuration
&lt;/h1&gt;

&lt;p&gt;&lt;strong&gt;minifix&lt;/strong&gt; is highly configurable. You can define your input files, output files, and minification options in a &lt;code&gt;minifix.config.mjs&lt;/code&gt; file. Here’s an example configuration:&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="cm"&gt;/* minifix.config.mjs */&lt;/span&gt;
&lt;span class="k"&gt;export&lt;/span&gt; &lt;span class="k"&gt;default&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;inputs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;views/input.html&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;assets/css/input.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;assets/js/input.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="na"&gt;outputs&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;views/index.html&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;assets/css/style.css&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;assets/js/default.js&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="p"&gt;],&lt;/span&gt;
    &lt;span class="na"&gt;minifyOptions&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="na"&gt;css&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;format&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="na"&gt;js&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;format&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
                &lt;span class="na"&gt;preamble&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="dl"&gt;"&lt;/span&gt;&lt;span class="s2"&gt;/** Comment */&lt;/span&gt;&lt;span class="dl"&gt;"&lt;/span&gt;
            &lt;span class="p"&gt;}&lt;/span&gt;
        &lt;span class="p"&gt;},&lt;/span&gt;
        &lt;span class="na"&gt;html&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
            &lt;span class="na"&gt;collapseWhitespace&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;removeComments&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
            &lt;span class="na"&gt;removeRedundantAttributes&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="kc"&gt;true&lt;/span&gt;
        &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;};&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In this example, &lt;strong&gt;minifix&lt;/strong&gt; will minify the specified input files and output the minified versions to the specified locations. You can also customize the minification options for each file type, such as preserving comments in JavaScript or removing redundant attributes in HTML.&lt;/p&gt;

&lt;h2&gt;
  
  
  Advanced Configuration
&lt;/h2&gt;

&lt;p&gt;Here’s how you can customize each type of file:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;CSS&lt;/strong&gt;: Use the &lt;a href="https://github.com/clean-css/clean-css#constructor-options" rel="noopener noreferrer"&gt;&lt;em&gt;clean-css&lt;/em&gt; constructor&lt;/a&gt; options to control how your CSS is minified. For example, you can disable formatting or enable advanced optimizations.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;JavaScript&lt;/strong&gt;: Customize JavaScript minification with &lt;a href="https://terser.org/docs/options/" rel="noopener noreferrer"&gt;&lt;em&gt;Terser&lt;/em&gt; options&lt;/a&gt;. You can add custom comments, control code formatting, and more.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;HTML&lt;/strong&gt;: Adjust HTML minification settings using &lt;a href="https://github.com/terser/html-minifier-terser#options-quick-reference" rel="noopener noreferrer"&gt;&lt;em&gt;html-minifier-terser&lt;/em&gt; options&lt;/a&gt;. Options like collapseWhitespace and removeComments allow you to control how your HTML is processed.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Supported File Types
&lt;/h3&gt;

&lt;p&gt;minifix supports minification for:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;JavaScript&lt;/strong&gt; (&lt;code&gt;.js&lt;/code&gt;,&lt;code&gt;.mjs&lt;/code&gt;,&lt;code&gt;.cjs&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;HTML&lt;/strong&gt; (&lt;code&gt;.html&lt;/code&gt;,&lt;code&gt;.htm&lt;/code&gt;)&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;CSS&lt;/strong&gt; (&lt;code&gt;.css&lt;/code&gt;)&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Why Use &lt;strong&gt;minifix&lt;/strong&gt;?
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;minifix&lt;/strong&gt; is designed to be a &lt;strong&gt;one-stop solution&lt;/strong&gt; for all your minification needs. Whether you’re working on a small project or a large-scale application, &lt;strong&gt;minifix&lt;/strong&gt; can help you optimize your code and improve performance. Its live file-watching feature ensures that your files are always up-to-date, and its configurable options give you full control over the minification process.&lt;/p&gt;

&lt;h3&gt;
  
  
  Contributing to &lt;strong&gt;minifix&lt;/strong&gt;
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;minifix&lt;/strong&gt; is an open-source project, and we welcome contributions from the community. If you encounter any issues or have suggestions for new features, feel free to open an issue on the &lt;a href="https://github.com/ramoures/minifix" rel="noopener noreferrer"&gt;GitHub repository&lt;/a&gt;. If you’d like to contribute code, you can fork the repository and submit a pull request.&lt;/p&gt;

&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;&lt;strong&gt;minifix&lt;/strong&gt; is a powerful and flexible tool that simplifies the process of minifying JavaScript, CSS, and HTML files. Whether you’re a seasoned developer or just starting out, &lt;strong&gt;minifix&lt;/strong&gt; can help you optimize your code and improve the performance of your web applications. Try it out and share your feedback with us!&lt;/p&gt;

&lt;p&gt;For more information, check out the &lt;a href="https://github.com/ramoures/minifix" rel="noopener noreferrer"&gt;&lt;strong&gt;minifix&lt;/strong&gt; GitHub repository&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>css</category>
      <category>html</category>
      <category>minifier</category>
    </item>
    <item>
      <title>React Server Side Rendering with Express and Vite</title>
      <dc:creator>ramoures</dc:creator>
      <pubDate>Tue, 30 Jul 2024 04:08:22 +0000</pubDate>
      <link>https://dev.to/ramoures/react-ssr-template-with-express-2149</link>
      <guid>https://dev.to/ramoures/react-ssr-template-with-express-2149</guid>
      <description>&lt;p&gt;ReactJS Server Side Rendering template (shopping website) with ExpressJS and ViteJS.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Node.js Streams&lt;/li&gt;
&lt;li&gt;Data fetching from Rest API&lt;/li&gt;
&lt;li&gt;Sitemap add-on&lt;/li&gt;
&lt;li&gt;SEO friendly&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://github.com/ramoures/express-react-ssr" rel="noopener noreferrer"&gt;Github Repository&lt;/a&gt;&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;a href="https://erssr.awaweb.ir/shop/" rel="noopener noreferrer"&gt;View Demo&lt;/a&gt;&lt;/strong&gt; - &lt;em&gt;&lt;a href="https://express-react-ssr.onrender.com/shop/" rel="noopener noreferrer"&gt;(Mirror Link)&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;h3&gt;
  
  
  Installation
&lt;/h3&gt;

&lt;ol&gt;
&lt;li&gt;&lt;code&gt;git clone https://github.com/ramoures/express-react-ssr.git&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;cd express-react-ssr&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;npm install&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;&lt;code&gt;npm run build&lt;/code&gt;&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm start&lt;/code&gt; or &lt;code&gt;node server.mjs&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Browse &lt;code&gt;http://localhost:5173/shop/&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Update the &lt;code&gt;.env&lt;/code&gt; file to edit/remove the &lt;em&gt;shop&lt;/em&gt; directory from the URL.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h3&gt;
  
  
  Develop
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Tailwind CLI build and minify process: &lt;code&gt;npm run tw&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;&lt;code&gt;npm run dev&lt;/code&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Browse &lt;code&gt;http://localhost:4173/shop/&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Always ready fresh template in development.&lt;/p&gt;

&lt;h3&gt;
  
  
  Build
&lt;/h3&gt;

&lt;p&gt;After development completion:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;code&gt;npm run build&lt;/code&gt; for build new &lt;em&gt;dist&lt;/em&gt; directory.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;npm start&lt;/code&gt; or &lt;code&gt;node server.mjs&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;Browse &lt;code&gt;http://localhost:5173/shop/&lt;/code&gt;
&lt;/li&gt;
&lt;/ol&gt;




&lt;h3&gt;
  
  
  I Used
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Node.js Stream&lt;/li&gt;
&lt;li&gt;Axios&lt;/li&gt;
&lt;li&gt;React Router Dom&lt;/li&gt;
&lt;li&gt;React Helmet&lt;/li&gt;
&lt;li&gt;Tailwind CSS framework&lt;/li&gt;
&lt;li&gt;&lt;strong&gt;XML Sitemap&lt;/strong&gt;&lt;/li&gt;
&lt;li&gt;...&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Data source: fakestoreapi.com&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb1bsmnvngaam0s7k0ce4.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fb1bsmnvngaam0s7k0ce4.png" alt="React server side rendering with express - api flowchart" width="800" height="601"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbm5cdoalzsc5ea537atg.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbm5cdoalzsc5ea537atg.png" alt="React server side rendering with express - flowchart" width="800" height="447"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;p&gt;License &lt;a href="https://github.com/ramoures/express-react-ssr/blob/main/LICENSE" rel="noopener noreferrer"&gt;Under The MIT License&lt;/a&gt;&lt;br&gt;
Email: &lt;a href="mailto:ramoures@gmail.com"&gt;ramoures@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>react</category>
      <category>frontend</category>
      <category>node</category>
      <category>vite</category>
    </item>
    <item>
      <title>PHP Phone Book</title>
      <dc:creator>ramoures</dc:creator>
      <pubDate>Fri, 01 Sep 2023 11:41:17 +0000</pubDate>
      <link>https://dev.to/ramoures/php-phone-book-2j36</link>
      <guid>https://dev.to/ramoures/php-phone-book-2j36</guid>
      <description>&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuc65j5mk9h6006iz9dps.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fuc65j5mk9h6006iz9dps.png" alt="php phonebook admin panel" width="800" height="186"&gt;&lt;/a&gt;&lt;/p&gt;




&lt;h3&gt;
  
  
  Demo
&lt;/h3&gt;

&lt;blockquote&gt;
&lt;p&gt;UTC Timezone&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://awaweb.ir/projects/free/php_phone_book/admin2023" rel="noopener noreferrer"&gt;Admin panel demo&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;username:&lt;/strong&gt; admin&lt;br&gt;
&lt;strong&gt;password:&lt;/strong&gt; 123&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://awaweb.ir/projects/free/php_phone_book" rel="noopener noreferrer"&gt;Front page demo&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Setup
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;1.Clone or download: &lt;a href="https://github.com/ramoures/PHP-Phone-Book" rel="noopener noreferrer"&gt;GitHub Repository&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;2.Create a new MySQL database.&lt;/li&gt;
&lt;li&gt;3.Set your &lt;strong&gt;database information&lt;/strong&gt; and your &lt;code&gt;PROJECT_URL&lt;/code&gt; in &lt;code&gt;config.php&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;4 &amp;amp; 5:&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;4.Browse &lt;code&gt;/setup&lt;/code&gt; to create the required tables and admin sign up.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;Ex. &lt;code&gt;https://localhost/PHP-Phone-Book/setup/&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;5.Remove &lt;code&gt;/setup&lt;/code&gt; directory.&lt;/li&gt;
&lt;/ul&gt;


&lt;/blockquote&gt;

&lt;h4&gt;
  
  
  OR
&lt;/h4&gt;

&lt;blockquote&gt;
&lt;ul&gt;
&lt;li&gt;4. Remove &lt;code&gt;/setup&lt;/code&gt; directory.&lt;/li&gt;
&lt;li&gt;5. IMPORT php_phone_book.sql to your database table.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;The username added after import is: admin , password: 123&lt;/p&gt;
&lt;/blockquote&gt;


&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;6.Set &lt;code&gt;media&lt;/code&gt; directory permission to 777.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;sudo chmod -R 777 media&lt;/code&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Requirement
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;Apache HTTP web server.&lt;/li&gt;
&lt;li&gt;MySQL database&lt;/li&gt;
&lt;li&gt;PHP ^8.2.4&lt;/li&gt;
&lt;li&gt;Apache module &lt;em&gt;mod-rewrite&lt;/em&gt; must be enabled.&lt;/li&gt;
&lt;li&gt;mysqli, mysqlnd, pdo ,pdo_mysql PHP extensions must be enabled.&lt;/li&gt;
&lt;/ul&gt;

&lt;blockquote&gt;
&lt;p&gt;To check the above: &lt;code&gt;&amp;lt;?php phpinfo(); ?&amp;gt;&lt;/code&gt; - &lt;a href="https://www.php.net/manual/en/function.phpinfo.php" rel="noopener noreferrer"&gt;PHPInfo&lt;/a&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ul&gt;
&lt;li&gt;allowOverride must be set to All in the Apache configuration file.&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  Information
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;HTTP Server: &lt;a href="https://httpd.apache.org/" rel="noopener noreferrer"&gt;Apache&lt;/a&gt; &lt;/li&gt;
&lt;li&gt;Programming language: &lt;a href="https://www.php.net/" rel="noopener noreferrer"&gt;PHP&lt;/a&gt; 8.2.4&lt;/li&gt;
&lt;li&gt;Programming paradigm: &lt;a href="https://en.wikipedia.org/wiki/Object-oriented_programming" rel="noopener noreferrer"&gt;OOP&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Architectural patterns: &lt;a href="https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93controller" rel="noopener noreferrer"&gt;MVC&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Template engine: &lt;a href="https://twig.symfony.com/" rel="noopener noreferrer"&gt;TWIG&lt;/a&gt; 3.0&lt;/li&gt;
&lt;li&gt;Database: &lt;a href="https://www.mysql.com/" rel="noopener noreferrer"&gt;MySQL&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Licensed under &lt;a href="https://github.com/ramoures/PHP-Phone-Book/blob/main/LICENSE" rel="noopener noreferrer"&gt;MIT&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;




&lt;h4&gt;
  
  
  I used:
&lt;/h4&gt;

&lt;ul&gt;
&lt;li&gt;URL Routing methods.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://twig.symfony.com/" rel="noopener noreferrer"&gt;TWIG&lt;/a&gt; template engine.&lt;/li&gt;
&lt;li&gt; &lt;em&gt;&lt;a href="https://www.php.net/manual/en/book.pdo.php" rel="noopener noreferrer"&gt;PDO&lt;/a&gt; &amp;amp; &lt;a href="https://www.php.net/manual/en/mysqli.quickstart.prepared-statements.php" rel="noopener noreferrer"&gt;Prepared Statements&lt;/a&gt;&lt;/em&gt; MySQL Connection.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://en.wikipedia.org/wiki/Singleton_pattern" rel="noopener noreferrer"&gt;Singleton&lt;/a&gt; &lt;a href="https://en.wikipedia.org/wiki/Design_Patterns" rel="noopener noreferrer"&gt;&lt;strong&gt;design patterns&lt;/strong&gt;&lt;/a&gt; for some required classes.&lt;/li&gt;
&lt;li&gt;Multi language suppourt.&lt;/li&gt;
&lt;li&gt;Many &lt;em&gt;options&lt;/em&gt; for configuration. &lt;em&gt;&lt;code&gt;config.php&lt;/code&gt;&lt;/em&gt;
&lt;/li&gt;
&lt;li&gt;Sorting and pagination of items.&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;Client and server side &lt;strong&gt;captcha&lt;/strong&gt; for sign in form.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Optional config: &lt;em&gt;Google reCaptcha&lt;/em&gt; or &lt;em&gt;Cloudflare Turnstile&lt;/em&gt;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Errors handling method.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;a href="https://getbootstrap.com/" rel="noopener noreferrer"&gt;Bootstrap&lt;/a&gt; and &lt;a href="https://jquery.com/" rel="noopener noreferrer"&gt;jQuery&lt;/a&gt;.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h3&gt;
  
  
  HELP
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Solutions
&lt;/h4&gt;

&lt;h5&gt;
  
  
  Enable the apache module &lt;em&gt;mod_rewrite&lt;/em&gt;
&lt;/h5&gt;

&lt;p&gt;&lt;code&gt;$ sudo a2enmod rewrite&lt;/code&gt;&lt;/p&gt;

&lt;h5&gt;
  
  
  Set config allowOverride All
&lt;/h5&gt;

&lt;p&gt;Edit the Apache config file:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ cd /etc/apache2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ sudo nano apache2.conf&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Find:&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;Directory /var/www/&amp;gt;
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
&amp;lt;/Directory&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;And change it to:&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;Directory /var/www/&amp;gt;
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
&amp;lt;/Directory&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;&lt;code&gt;/var/www/&lt;/code&gt; : your root directory.&lt;/p&gt;

&lt;p&gt;Press Ctrl + o (for save), then Ctrl + x (for exit).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Then,&lt;/p&gt;

&lt;p&gt;&lt;code&gt;$ sudo systemctl restart apache2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://httpd.apache.org/docs/current/mod/mod_rewrite.html" rel="noopener noreferrer"&gt;Apache mod_rewrite module&lt;/a&gt;&lt;/p&gt;




&lt;h4&gt;
  
  
  Add new language
&lt;/h4&gt;

&lt;ol&gt;
&lt;li&gt;Create your language file in the &lt;code&gt;lang&lt;/code&gt; folder.&lt;/li&gt;
&lt;/ol&gt;

&lt;blockquote&gt;
&lt;p&gt;Ex. &lt;em&gt;fr.php&lt;/em&gt; or &lt;em&gt;ar.php&lt;/em&gt; and develop similar to &lt;code&gt;lang/fa.php&lt;/code&gt;.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;ol&gt;
&lt;li&gt;Add your new language for frontend pages.
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Example: --&amp;gt;
&amp;lt;div class="changeLanguage"&amp;gt;
     &amp;lt;button id="fr"&amp;gt;Fr&amp;lt;/button&amp;gt;
     &amp;lt;button id="en"&amp;gt;En&amp;lt;/button&amp;gt;
&amp;lt;/div&amp;gt;
&amp;lt;!-- Look at: .changeLanguage click function on view/assets/js/app.js or backend.js  --&amp;gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;E-Mail: &lt;a href="mailto:ramoures@gmail.com"&gt;ramoures@gmail.com&lt;/a&gt;&lt;/p&gt;

</description>
      <category>php</category>
      <category>mysql</category>
      <category>backend</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
