<?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: zu</title>
    <description>The latest articles on DEV Community by zu (@zu).</description>
    <link>https://dev.to/zu</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%2F1153036%2F66caeb41-5fc7-4bed-8dac-a2fe6510cb9c.jpeg</url>
      <title>DEV Community: zu</title>
      <link>https://dev.to/zu</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/zu"/>
    <language>en</language>
    <item>
      <title>Question: The Future of Programmers</title>
      <dc:creator>zu</dc:creator>
      <pubDate>Sun, 08 Oct 2023 10:25:14 +0000</pubDate>
      <link>https://dev.to/zu/question-the-future-of-programmers-15h4</link>
      <guid>https://dev.to/zu/question-the-future-of-programmers-15h4</guid>
      <description>&lt;p&gt;I want to know, as a mature programmer who has worked for many years, what other ways do you accumulate wealth&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>web</category>
    </item>
    <item>
      <title>From Tailwind CSS to UnoCSS - Is Atomization Really the Savior of Frontend CSS</title>
      <dc:creator>zu</dc:creator>
      <pubDate>Mon, 04 Sep 2023 08:56:48 +0000</pubDate>
      <link>https://dev.to/zu/from-tailwind-css-to-unocss-is-atomization-really-the-savior-of-frontend-css-28in</link>
      <guid>https://dev.to/zu/from-tailwind-css-to-unocss-is-atomization-really-the-savior-of-frontend-css-28in</guid>
      <description>&lt;h2&gt;
  
  
  Write in front
&lt;/h2&gt;

&lt;p&gt;Looking back at the past and traversing the previous dynasties, CSS was also one of the three frontend swordsmen of that time, and it was very impressive. With the leapfrog transformation of the front-end, CSS seems to have become a bit unknown in modern front-end development.&lt;/p&gt;

&lt;p&gt;It has to be said that before seeing &lt;code&gt;UnoCSS&lt;/code&gt;, I had not even heard of the concept of atomized CSS (ashamed, ashamed), and had not followed CSS related content for a long time.&lt;/p&gt;

&lt;p&gt;The concept of atomized CSS itself and the design of Tailwind CSS and UnoCSS are relatively simple. Here, we mainly want to talk about whether atomized CSS is a perfect solution in modern front-end and the correct direction to solve CSS problems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Atomic CSS
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;Atomic CSS is the approach to CSS architecture that favors small, single-purpose classes with names based on visual function.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;It sounds great, but the final implementation method is super simple. The core is to preset a large number of class styles, and try to simplify and simplify these class styles as much as possible. During the development process, you can directly write the preset class names in the DOM to quickly implement the styles, without the need to write a lot of simple and boring CSS styles each time, as shown in the following code:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt; Pre set a set of class lists first
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.m-10&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;10px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.p-5&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;padding&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;5px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nc"&gt;.text-red&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt; &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="no"&gt;red&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="p"&gt;}&lt;/span&gt;
 &lt;span class="o"&gt;//&lt;/span&gt; &lt;span class="nt"&gt;more&lt;/span&gt;&lt;span class="o"&gt;....&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;ol&gt;
&lt;li&gt; Write the class name directly in the dom during encoding to quickly implement styles
&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"m-10 p-5 text-red"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    dom
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The styles in the preset class list have certain patterns, and developers can quickly grasp them through learning and use the &lt;strong&gt;combination&lt;/strong&gt; of multiple classes in the dom to quickly achieve results&lt;/p&gt;

&lt;p&gt;😮😮，Does it look a bit familiar? (The dead &lt;strong&gt;Bootstrap&lt;/strong&gt; attacked me), so do you think this is cold rice stir fry or pragmatism?&lt;/p&gt;

&lt;h2&gt;
  
  
  Tailwind CSS Widely popular
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fp3-juejin.byteimg.com%2Ftos-cn-i-k3u1fbpfcp%2F87686cf54d274a43b3249e3ec65c521b~tplv-k3u1fbpfcp-zoom-1.image" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fp3-juejin.byteimg.com%2Ftos-cn-i-k3u1fbpfcp%2F87686cf54d274a43b3249e3ec65c521b~tplv-k3u1fbpfcp-zoom-1.image" alt="Cover image for 4 Reasons why I start using Tailwind CSS in every project"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Github in [tailwindcss]（ &lt;a href="https://github.com/tailwindlabs/tailwindcss" rel="noopener noreferrer"&gt;https://github.com/tailwindlabs/tailwindcss&lt;/a&gt; ）So far, there are already '70.8K' stars, At first, I couldn't believe it was so popular, with over six million downloads per week for NPM.&lt;/p&gt;

&lt;p&gt;Tailwind CSS advocates for allowing you to quickly build websites without leaving HTML, and has many very practical &lt;strong&gt;advantages&lt;/strong&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Extreme encapsulation of classes to maximize reusability&lt;/li&gt;
&lt;li&gt;Various customizable configurations that are easy to expand&lt;/li&gt;
&lt;li&gt;Clear unreferenced CSS styles during construction to address the issue of CSS redundancy in production environments&lt;/li&gt;
&lt;li&gt;Comfortable responsive development experience&lt;/li&gt;
&lt;li&gt;Functions, instructions, layouts, animations ....and so on&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;It almost covers all the headaches and uncomfortable development experiences that developers encounter in their daily native CSS development, so it is indeed a very practical tool. Tailwind CSS really benefits front-end developers.&lt;/p&gt;

&lt;p&gt;Tailwind CSS can be used as a PostCSS plugin in the front-end construction toolchain in combination with other preprocessing methods to optimize CSS production products.&lt;/p&gt;

&lt;h2&gt;
  
  
  UnoCSS
&lt;/h2&gt;

&lt;p&gt;Tailwind CSS has been widely popular in the past few years, and in the past two years, 'UnoCSS' has stood out again. Here, we need to first praise the icon, text, and background color gradient linkage theme on the UnoCSS official website. &lt;br&gt;
It's cool!!&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fp3-juejin.byteimg.com%2Ftos-cn-i-k3u1fbpfcp%2Fdaef020f92b6418d9d2c1d40c6a640eb~tplv-k3u1fbpfcp-zoom-1.image" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fp3-juejin.byteimg.com%2Ftos-cn-i-k3u1fbpfcp%2Fdaef020f92b6418d9d2c1d40c6a640eb~tplv-k3u1fbpfcp-zoom-1.image" alt="Cover image for UnoCSS, Vite + Vue3 easy setup"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;According to the author of UnoCSS, &lt;strong&gt;UnoCSS is not meant to replace Tailwind CSS, but rather to integrate atomized CSS more perfectly in the business from another perspective&lt;/strong&gt;.&lt;/p&gt;

&lt;p&gt;The author of UnoCSS is a member of the Vite team, and I believe it is precisely because he, as a developer of Vite, has a high sensitivity to engineering construction that UnoCSS was created to integrate atomized CSS with front-end engineering to the extreme.&lt;/p&gt;

&lt;p&gt;So what did UnoCSS do&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;On demand generation&lt;/strong&gt;

&lt;ul&gt;
&lt;li&gt;Generate the classes that the business truly uses, and use them in both development and production environments&lt;/li&gt;
&lt;li&gt;Compared to Tailwind CSS, which only clears unreferenced code during the production phase, UnoCSS also achieves faster performance through file monitoring and on-demand transmission during the development phase (although it's already fast, even faster is always an improvement)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fp3-juejin.byteimg.com%2Ftos-cn-i-k3u1fbpfcp%2Febdc4b812eee4893b4481b76e238881e~tplv-k3u1fbpfcp-zoom-1.image" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fp3-juejin.byteimg.com%2Ftos-cn-i-k3u1fbpfcp%2Febdc4b812eee4893b4481b76e238881e~tplv-k3u1fbpfcp-zoom-1.image" alt="image-20230803213902695"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fp3-juejin.byteimg.com%2Ftos-cn-i-k3u1fbpfcp%2F2a921234ca34420ea9ed187cb65eb6b5~tplv-k3u1fbpfcp-zoom-1.image" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fp3-juejin.byteimg.com%2Ftos-cn-i-k3u1fbpfcp%2F2a921234ca34420ea9ed187cb65eb6b5~tplv-k3u1fbpfcp-zoom-1.image" alt="image-20230803213919428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;&lt;strong&gt;Highly flexible&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;p&gt;UnoCSS positions itself as a CSS engine rather than a framework, so it should have an inclusion relationship with Tailwind CSS. UnoCSS serves as the rulemaker, while Tailwind CSS can serve as a set of presets&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;UnocssPlugin&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;@unocss/vite&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;

&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;PresetTachyons&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;@unocss/preset-tachyons&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;PresetBootstrap&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;@unocss/preset-bootstrap&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;PresetTailwind&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;@unocss/preset-tailwind&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;PresetWindi&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;@unocss/preset-windi&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;
&lt;span class="k"&gt;import&lt;/span&gt; &lt;span class="nx"&gt;PresetAntfu&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;@antfu/oh-my-cool-unocss-preset&lt;/span&gt;&lt;span class="dl"&gt;'&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;plugins&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
    &lt;span class="nc"&gt;UnocssPlugin&lt;/span&gt;&lt;span class="p"&gt;({&lt;/span&gt;
      &lt;span class="na"&gt;presets&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;
        &lt;span class="c1"&gt;// PresetTachyons,&lt;/span&gt;
        &lt;span class="nx"&gt;PresetBootstrap&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;
        &lt;span class="c1"&gt;// PresetTailwind,&lt;/span&gt;
        &lt;span class="c1"&gt;// PresetWindi,&lt;/span&gt;
        &lt;span class="c1"&gt;// PresetAntfu&lt;/span&gt;
        &lt;span class="c1"&gt;// 选择其中一个...或多个！&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;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;

&lt;p&gt;Simplify class naming&lt;br&gt;
&lt;/p&gt;

&lt;pre class="highlight html"&gt;&lt;code&gt;// Distinguish lengthy calss by type for easier reading and understanding
&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"bg-blue-400 hover:bg-blue-500 text-sm text-white font-mono font-light py-2 px-4 rounded border-2 border-blue-200 dark:bg-blue-500 dark:hover:bg-blue-600"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  Button
&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;

// Change to
&lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; 
  &lt;span class="na"&gt;bg=&lt;/span&gt;&lt;span class="s"&gt;"blue-400 hover:blue-500 dark:blue-500 dark:hover:blue-600"&lt;/span&gt;
  &lt;span class="na"&gt;text=&lt;/span&gt;&lt;span class="s"&gt;"sm white"&lt;/span&gt;
  &lt;span class="na"&gt;font=&lt;/span&gt;&lt;span class="s"&gt;"mono light"&lt;/span&gt;
  &lt;span class="na"&gt;p=&lt;/span&gt;&lt;span class="s"&gt;"y-2 x-4"&lt;/span&gt;
  &lt;span class="na"&gt;border=&lt;/span&gt;&lt;span class="s"&gt;"2 rounded blue-200"&lt;/span&gt;
&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  Button
&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;




&lt;/li&gt;

&lt;li&gt;&lt;p&gt;In terms of custom rules, UnoCSS provides more flexible static and dynamic matching rules&lt;/p&gt;&lt;/li&gt;

&lt;li&gt;&lt;p&gt;Further optimization of compilation (such as no longer parsing AST), resulting in a further increase in production build speed&lt;/p&gt;&lt;/li&gt;

&lt;/ul&gt;

&lt;/li&gt;

&lt;/ul&gt;

&lt;p&gt;UnoCSS is equivalent to building a higher-level engine, and in the future, new atomic CSS frameworks can also be compatible, saving you the difficulty of choosing.&lt;/p&gt;

&lt;h2&gt;
  
  
  Atomized CSS is not the savior of modern front-end CSS
&lt;/h2&gt;

&lt;p&gt;The characteristics and usage methods of Tailwind CSS and UnoCSS are not the main focus of this article. You can refer to the official website for specific details. Here, we mainly want to discuss&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;&lt;strong&gt;Will atomized CSS from Tailwind CSS or UnoCSS be the best practice for modern front-end solutions to CSS problems&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;I think the answer is no&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;From my direct perception, atomized CSS is more like an auxiliary utility tool than a solution to CSS problems. As an auxiliary tool, it can indeed provide great help in certain business scenarios or stages of business development, but from the perspective of the entire complex and ever-changing front-end business scenario, its capabilities are limited.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;The most intuitive result is that when the complexity of the business increases to a certain stage, the cost-effectiveness of atomized CSS will sharply decrease, resulting in HTML code redundancy, poor readability, and difficulty in maintenance, which will directly affect business development.&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Especially now, both Vue's single file components and React's functional components inject some JS logic into HTML. If CSS logic also needs to be injected through class name combinations, it would be too confusing.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;However, Vue or React's respective componentization design ideas can solve the problem of code redundancy through their respective componentization splitting, making it suitable for various simple and complex business scenarios, which is a complete set of best practices. Atomized CSS cannot do componentization splitting, so as business complexity increases, code redundancy will occur sooner or later, which directly limits the popularity of such frameworks, So it cannot serve as the fundamental solution to front-end CSS issues&lt;/strong&gt;&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;From a design perspective, atomic CSS also seems to be out of place with the current mainstream of componentization and functional programming.&lt;/p&gt;

&lt;h3&gt;
  
  
  Applicable scenarios
&lt;/h3&gt;

&lt;p&gt;In some simple business scenarios, atomic CSS does have significant advantages, such as rapid development of responsive H5, low business complexity in the backend system, and simple official website pages.&lt;/p&gt;

&lt;p&gt;In some complex business scenarios, such as complex C-end business, large systems are no longer suitable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Reference Article
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://antfu.me/posts/reimagine-atomic-css" rel="noopener noreferrer"&gt;Reimagine Atomic CSS&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>css</category>
      <category>react</category>
      <category>vue</category>
    </item>
    <item>
      <title>Hello world</title>
      <dc:creator>zu</dc:creator>
      <pubDate>Mon, 04 Sep 2023 08:28:53 +0000</pubDate>
      <link>https://dev.to/zu/hello-world-ibf</link>
      <guid>https://dev.to/zu/hello-world-ibf</guid>
      <description>&lt;p&gt;Hi,I am ZU.&lt;br&gt;
I come from China.&lt;br&gt;
Thank &lt;/p&gt;

</description>
      <category>javascript</category>
      <category>react</category>
      <category>vue</category>
    </item>
  </channel>
</rss>
