[{"data":1,"prerenderedAt":932},["ShallowReactive",2],{"series-\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Fmigrating-our-vitepress-blog-to-tailwind-css-version-4":3,"series-context-\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch":622},{"id":4,"title":5,"body":6,"contentId":607,"date":608,"description":609,"extension":610,"github":611,"meetTheInstructor":613,"meta":614,"navigation":260,"part":564,"path":615,"rawbody":616,"robots":613,"schemaOrg":613,"seo":617,"seriesSlug":618,"sitemap":619,"stem":620,"subtitle":613,"topics":613,"__hash__":621},"series\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Fmigrating-our-vitepress-blog-to-tailwind-css-version-4.md","Migrating Our VitePress Blog to Tailwind CSS Version 4",{"type":7,"value":8,"toc":602},"minimark",[9,25,41,46,63,162,165,182,201,211,215,222,311,314,318,331,334,364,367,383,389,392,436,443,454,464,585,593,598],[10,11,12,13,17,18,21,22,24],"p",{},"Since the first episode of this series, ",[14,15,16],"strong",{},"Tailwind CSS"," has released a new major version, bringing numerous new features and enhancements. In this episode, we will migrate our ",[14,19,20],{},"VitePress"," blog to Tailwind CSS 4.0. This process is simpler than you might think and will enable us to utilize the latest features of ",[14,23,16],{}," while keeping our blog up-to-date.",[26,27,30],"callout",{"color":28,"icon":29},"info","i-ph-info-duotone",[10,31,32,33,40],{},"I won't present the latest features of Tailwind CSS 4.0 in this episode. I recommend you read the ",[34,35,39],"a",{"href":36,"rel":37},"https:\u002F\u002Ftailwindcss.com\u002Fblog\u002Ftailwindcss-v4",[38],"nofollow","official announcement"," on the Tailwind CSS blog.",[42,43,45],"h2",{"id":44},"upgrading-dependencies","Upgrading dependencies",[10,47,48,49,54,55,57,58,62],{},"First, we need to upgrade our dependencies. To do this, I love using ",[34,50,53],{"href":51,"rel":52},"https:\u002F\u002Fgithub.com\u002Fantfu-collective\u002Ftaze",[38],"taze",", but since we are only updating ",[14,56,16],{},", we can do it manually. Open your ",[59,60,61],"code",{},"package.json"," file and update the following dependencies:",[64,65,70],"pre",{"className":66,"code":67,"filename":61,"language":68,"meta":69,"style":69},"language-json shiki shiki-themes github-light github-light github-dark has-diff","{\n  \"devDependencies\": {\n    \"tailwindcss\": \"^4.1.5\", \u002F\u002F [!code ++]\n    \"@tailwindcss\u002Fvite\": \"^4.1.5\", \u002F\u002F [!code ++]\n    \"autoprefixer\": \"^10.4.20\", \u002F\u002F [!code --]\n    \"postcss\": \"^8.5.1\" \u002F\u002F [!code --]\n  }\n}\n","json","",[59,71,72,81,91,110,123,138,150,156],{"__ignoreMap":69},[73,74,77],"span",{"class":75,"line":76},"line",1,[73,78,80],{"class":79},"sxrX7","{\n",[73,82,84,88],{"class":75,"line":83},2,[73,85,87],{"class":86},"sBjJW","  \"devDependencies\"",[73,89,90],{"class":79},": {\n",[73,92,97,100,103,107],{"class":93,"line":96},[75,94,95],"diff","add",3,[73,98,99],{"class":86},"    \"tailwindcss\"",[73,101,102],{"class":79},": ",[73,104,106],{"class":105},"sIIMD","\"^4.1.5\"",[73,108,109],{"class":79},", ",[73,111,114,117,119,121],{"class":112,"line":113},[75,94,95],4,[73,115,116],{"class":86},"    \"@tailwindcss\u002Fvite\"",[73,118,102],{"class":79},[73,120,106],{"class":105},[73,122,109],{"class":79},[73,124,128,131,133,136],{"class":125,"line":127},[75,94,126],"remove",5,[73,129,130],{"class":86},"    \"autoprefixer\"",[73,132,102],{"class":79},[73,134,135],{"class":105},"\"^10.4.20\"",[73,137,109],{"class":79},[73,139,142,145,147],{"class":140,"line":141},[75,94,126],6,[73,143,144],{"class":86},"    \"postcss\"",[73,146,102],{"class":79},[73,148,149],{"class":105},"\"^8.5.1\"",[73,151,153],{"class":75,"line":152},7,[73,154,155],{"class":79},"  }\n",[73,157,159],{"class":75,"line":158},8,[73,160,161],{"class":79},"}\n",[10,163,164],{},"Then, run the following command to install the new dependencies:",[64,166,171],{"className":167,"code":168,"filename":169,"language":170,"meta":69,"style":69},"language-bash shiki shiki-themes github-light github-light github-dark","pnpm install\n","terminal","bash",[59,172,173],{"__ignoreMap":69},[73,174,175,179],{"class":75,"line":76},[73,176,178],{"class":177},"snPdu","pnpm",[73,180,181],{"class":105}," install\n",[10,183,184,185,188,189,192,193,196,197,200],{},"There are multiple things to note with this change. First, there is a new dependency called ",[59,186,187],{},"@tailwindcss\u002Fvite",", which is the new ",[14,190,191],{},"Vite"," plugin for Tailwind CSS, simplifying the installation process. Additionally, the ",[59,194,195],{},"autoprefixer"," and ",[59,198,199],{},"postcss"," dependencies are now unnecessary.",[10,202,203,204,207,208,210],{},"This means that the ",[59,205,206],{},"postcss.config.cjs"," file can be safely removed, as Tailwind CSS now relies on ",[14,209,191],{}," for CSS processing. This change enhances both performance and developer experience, one of the best features of this new version.",[42,212,214],{"id":213},"using-the-new-vite-plugin","Using the new Vite plugin",[10,216,217,218,221],{},"A new Vite plugin means we need to update our VitePress configuration to use it. Open your ",[59,219,220],{},".vitepress\u002Fconfig.mts"," file and update the following code:",[64,223,227],{"className":224,"code":225,"filename":220,"language":226,"meta":69,"style":69},"language-ts shiki shiki-themes github-light github-light github-dark has-diff","import Tailwind from '@tailwindcss\u002Fvite'\nimport { defineConfig } from 'vitepress'\n\nexport default defineConfig({\n  vite: {\n    plugins: [\n      Tailwind() \u002F\u002F [!code ++]\n    ]\n  }\n})\n","ts",[59,228,229,244,256,262,276,281,286,295,300,305],{"__ignoreMap":69},[73,230,231,235,238,241],{"class":75,"line":76},[73,232,234],{"class":233},"s8jYJ","import",[73,236,237],{"class":79}," Tailwind ",[73,239,240],{"class":233},"from",[73,242,243],{"class":105}," '@tailwindcss\u002Fvite'\n",[73,245,246,248,251,253],{"class":75,"line":83},[73,247,234],{"class":233},[73,249,250],{"class":79}," { defineConfig } ",[73,252,240],{"class":233},[73,254,255],{"class":105}," 'vitepress'\n",[73,257,258],{"class":75,"line":96},[73,259,261],{"emptyLinePlaceholder":260},true,"\n",[73,263,264,267,270,273],{"class":75,"line":113},[73,265,266],{"class":233},"export",[73,268,269],{"class":233}," default",[73,271,272],{"class":177}," defineConfig",[73,274,275],{"class":79},"({\n",[73,277,278],{"class":75,"line":127},[73,279,280],{"class":79},"  vite: {\n",[73,282,283],{"class":75,"line":141},[73,284,285],{"class":79},"    plugins: [\n",[73,287,289,292],{"class":288,"line":152},[75,94,95],[73,290,291],{"class":177},"      Tailwind",[73,293,294],{"class":79},"() ",[73,296,297],{"class":75,"line":158},[73,298,299],{"class":79},"    ]\n",[73,301,303],{"class":75,"line":302},9,[73,304,155],{"class":79},[73,306,308],{"class":75,"line":307},10,[73,309,310],{"class":79},"})\n",[10,312,313],{},"And that's it!",[42,315,317],{"id":316},"updating-the-tailwind-css-usage","Updating the Tailwind CSS usage",[10,319,320,321,323,324,327,328,330],{},"Now that we've updated our dependencies and VitePress configuration, we need to update the usage of ",[14,322,16],{}," in our ",[59,325,326],{},"app.css"," file. In its latest version, Tailwind CSS has moved to a CSS-based configuration, streamlining the installation process. This means we need to update our ",[59,329,326],{}," file.",[10,332,333],{},"From:",[64,335,340],{"className":336,"code":337,"filename":338,"language":339,"meta":69,"style":69},"language-css shiki shiki-themes github-light github-light github-dark","@tailwind base;\n@tailwind components;\n@tailwind utilities;\n",".vitepress\u002Ftheme\u002Fcommon\u002Fstyles\u002Fapp.css","css",[59,341,342,350,357],{"__ignoreMap":69},[73,343,344,347],{"class":75,"line":76},[73,345,346],{"class":233},"@tailwind",[73,348,349],{"class":79}," base;\n",[73,351,352,354],{"class":75,"line":83},[73,353,346],{"class":233},[73,355,356],{"class":79}," components;\n",[73,358,359,361],{"class":75,"line":96},[73,360,346],{"class":233},[73,362,363],{"class":79}," utilities;\n",[10,365,366],{},"To:",[64,368,370],{"className":336,"code":369,"filename":338,"language":339,"meta":69,"style":69},"@import 'tailwindcss';\n",[59,371,372],{"__ignoreMap":69},[73,373,374,377,380],{"class":75,"line":76},[73,375,376],{"class":233},"@import",[73,378,379],{"class":105}," 'tailwindcss'",[73,381,382],{"class":79},";\n",[10,384,385,386,388],{},"Instead of relying on custom CSS directives, we can now use the native directive ",[59,387,376],{}," to incorporate Tailwind CSS.",[10,390,391],{},"Then, we migrate our configuration to the new CSS-based configuration.",[64,393,395],{"className":336,"code":394,"filename":338,"language":339,"meta":69,"style":69},"@config \"..\u002F..\u002F..\u002F..\u002Ftailwind.config.cjs\";\n\n@plugin \"@tailwindcss\u002Ftypography\";\n\n@source '..\u002F..\u002F..\u002F..\u002Fsrc\u002F**\u002F*.md';\n@source '..\u002F..\u002F**\u002F*.{vue,ts}';\n",[59,396,397,405,409,417,421,429],{"__ignoreMap":69},[73,398,399,402],{"class":75,"line":76},[73,400,401],{"class":233},"@config",[73,403,404],{"class":79}," \"..\u002F..\u002F..\u002F..\u002Ftailwind.config.cjs\";\n",[73,406,407],{"class":75,"line":83},[73,408,261],{"emptyLinePlaceholder":260},[73,410,411,414],{"class":75,"line":96},[73,412,413],{"class":233},"@plugin",[73,415,416],{"class":79}," \"@tailwindcss\u002Ftypography\";\n",[73,418,419],{"class":75,"line":113},[73,420,261],{"emptyLinePlaceholder":260},[73,422,423,426],{"class":75,"line":127},[73,424,425],{"class":233},"@source",[73,427,428],{"class":79}," '..\u002F..\u002F..\u002F..\u002Fsrc\u002F**\u002F*.md';\n",[73,430,431,433],{"class":75,"line":141},[73,432,425],{"class":233},[73,434,435],{"class":79}," '..\u002F..\u002F**\u002F*.{vue,ts}';\n",[10,437,438,439,442],{},"In theory, we could completely remove the current JavaScript configuration file, but since we are using the ",[59,440,441],{},"@tailwindcss\u002Ftypography"," plugin, we need to keep it.",[26,444,445],{"color":28,"icon":29},[10,446,447,448,453],{},"Adam Wathan, the creator of Tailwind CSS, ",[34,449,452],{"href":450,"rel":451},"https:\u002F\u002Fx.com\u002Fadamwathan\u002Fstatus\u002F1894776336402583835",[38],"has plans for the typography plugin",", but we do not have any details yet.",[10,455,456,457,196,460,463],{},"However, we can still remove the ",[59,458,459],{},"content",[59,461,462],{},"plugins"," properties from the configuration file.",[64,465,470],{"className":466,"code":467,"filename":468,"language":469,"meta":69,"style":69},"language-js shiki shiki-themes github-light github-light github-dark has-diff","\u002F** @type {import('tailwindcss').Config} *\u002F\nmodule.exports = {\n  content: ['.\u002Fsrc\u002F**\u002F*.md', '.\u002F.vitepress\u002Ftheme\u002F**\u002F*.{vue,ts}'], \u002F\u002F [!code --]\n  theme: {\n    extend: {\n      typography: {\n        \u002F\u002F ...\n      },\n    },\n  },\n\n  plugins: [require('@tailwindcss\u002Ftypography')], \u002F\u002F [!code --]\n}\n","tailwind.config.cjs","js",[59,471,472,487,504,521,526,531,536,541,546,551,556,561,580],{"__ignoreMap":69},[73,473,474,478,481,484],{"class":75,"line":76},[73,475,477],{"class":476},"sCsY4","\u002F** ",[73,479,480],{"class":233},"@type",[73,482,483],{"class":177}," {import('tailwindcss').Config}",[73,485,486],{"class":476}," *\u002F\n",[73,488,489,492,495,498,501],{"class":75,"line":83},[73,490,491],{"class":86},"module",[73,493,494],{"class":79},".",[73,496,497],{"class":86},"exports",[73,499,500],{"class":233}," =",[73,502,503],{"class":79}," {\n",[73,505,507,510,513,515,518],{"class":506,"line":96},[75,94,126],[73,508,509],{"class":79},"  content: [",[73,511,512],{"class":105},"'.\u002Fsrc\u002F**\u002F*.md'",[73,514,109],{"class":79},[73,516,517],{"class":105},"'.\u002F.vitepress\u002Ftheme\u002F**\u002F*.{vue,ts}'",[73,519,520],{"class":79},"], ",[73,522,523],{"class":75,"line":113},[73,524,525],{"class":79},"  theme: {\n",[73,527,528],{"class":75,"line":127},[73,529,530],{"class":79},"    extend: {\n",[73,532,533],{"class":75,"line":141},[73,534,535],{"class":79},"      typography: {\n",[73,537,538],{"class":75,"line":152},[73,539,540],{"class":476},"        \u002F\u002F ...\n",[73,542,543],{"class":75,"line":158},[73,544,545],{"class":79},"      },\n",[73,547,548],{"class":75,"line":302},[73,549,550],{"class":79},"    },\n",[73,552,553],{"class":75,"line":307},[73,554,555],{"class":79},"  },\n",[73,557,559],{"class":75,"line":558},11,[73,560,261],{"emptyLinePlaceholder":260},[73,562,565,568,571,574,577],{"class":563,"line":564},[75,94,126],12,[73,566,567],{"class":79},"  plugins: [",[73,569,570],{"class":177},"require",[73,572,573],{"class":79},"(",[73,575,576],{"class":105},"'@tailwindcss\u002Ftypography'",[73,578,579],{"class":79},")], ",[73,581,583],{"class":75,"line":582},13,[73,584,161],{"class":79},[10,586,587,588,323,590,592],{},"And that's it! We are now using the latest version of ",[14,589,16],{},[14,591,20],{}," blog!",[10,594,595,596,494],{},"I hope you enjoyed this overview of the migration that ensures our blog stays updated to enable us to use the latest features of ",[14,597,16],{},[599,600,601],"style",{},"html pre.shiki code .sxrX7, html code.shiki .sxrX7{--shiki-light:#24292E;--shiki-default:#24292E;--shiki-dark:#E1E4E8}html pre.shiki code .sBjJW, html code.shiki .sBjJW{--shiki-light:#005CC5;--shiki-default:#005CC5;--shiki-dark:#79B8FF}html pre.shiki code .sIIMD, html code.shiki .sIIMD{--shiki-light:#032F62;--shiki-default:#032F62;--shiki-dark:#9ECBFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html pre.shiki code .snPdu, html code.shiki .snPdu{--shiki-light:#6F42C1;--shiki-default:#6F42C1;--shiki-dark:#B392F0}html pre.shiki code .s8jYJ, html code.shiki .s8jYJ{--shiki-light:#D73A49;--shiki-default:#D73A49;--shiki-dark:#F97583}html pre.shiki code .sCsY4, html code.shiki .sCsY4{--shiki-light:#6A737D;--shiki-default:#6A737D;--shiki-dark:#6A737D}",{"title":69,"searchDepth":83,"depth":83,"links":603},[604,605,606],{"id":44,"depth":83,"text":45},{"id":213,"depth":83,"text":214},{"id":316,"depth":83,"text":317},"3499bbd1-20a6-43f0-9bb7-be1da2bb6eac","2025-05-08","A step-by-step guide on upgrading our VitePress blog to Tailwind CSS 4.0 to leverage its latest features and improvements.","md",{"branch":612},"12.migration-to-tailwind-css-4",null,{},"\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Fmigrating-our-vitepress-blog-to-tailwind-css-version-4","---\ncontentId: 3499bbd1-20a6-43f0-9bb7-be1da2bb6eac\npart: 12\ntitle: \"Migrating Our VitePress Blog to Tailwind CSS Version 4\"\ndescription: \"A step-by-step guide on upgrading our VitePress blog to Tailwind CSS 4.0 to leverage its latest features and improvements.\"\ngithub:\n  branch: 12.migration-to-tailwind-css-4\ndate: 2025-05-08\nseriesSlug: create-a-blog-with-vitepress-and-vue-js-from-scratch\n---\n\nSince the first episode of this series, **Tailwind CSS** has released a new major version, bringing numerous new features and enhancements. In this episode, we will migrate our **VitePress** blog to Tailwind CSS 4.0. This process is simpler than you might think and will enable us to utilize the latest features of **Tailwind CSS** while keeping our blog up-to-date.\n\n::callout{icon=\"i-ph-info-duotone\" color=\"info\"}\nI won't present the latest features of Tailwind CSS 4.0 in this episode. I recommend you read the [official announcement](https:\u002F\u002Ftailwindcss.com\u002Fblog\u002Ftailwindcss-v4) on the Tailwind CSS blog.\n::\n\n## Upgrading dependencies\n\nFirst, we need to upgrade our dependencies. To do this, I love using [taze](https:\u002F\u002Fgithub.com\u002Fantfu-collective\u002Ftaze), but since we are only updating **Tailwind CSS**, we can do it manually. Open your `package.json` file and update the following dependencies:\n\n```json [package.json]\n{\n  \"devDependencies\": {\n    \"tailwindcss\": \"^4.1.5\", \u002F\u002F [!code ++]\n    \"@tailwindcss\u002Fvite\": \"^4.1.5\", \u002F\u002F [!code ++]\n    \"autoprefixer\": \"^10.4.20\", \u002F\u002F [!code --]\n    \"postcss\": \"^8.5.1\" \u002F\u002F [!code --]\n  }\n}\n```\n\nThen, run the following command to install the new dependencies:\n\n```bash [terminal]\npnpm install\n```\n\nThere are multiple things to note with this change. First, there is a new dependency called `@tailwindcss\u002Fvite`, which is the new **Vite** plugin for Tailwind CSS, simplifying the installation process. Additionally, the `autoprefixer` and `postcss` dependencies are now unnecessary.\n\nThis means that the `postcss.config.cjs` file can be safely removed, as Tailwind CSS now relies on **Vite** for CSS processing. This change enhances both performance and developer experience, one of the best features of this new version.\n\n## Using the new Vite plugin\n\nA new Vite plugin means we need to update our VitePress configuration to use it. Open your `.vitepress\u002Fconfig.mts` file and update the following code:\n\n```ts [.vitepress\u002Fconfig.mts]\nimport Tailwind from '@tailwindcss\u002Fvite'\nimport { defineConfig } from 'vitepress'\n\nexport default defineConfig({\n  vite: {\n    plugins: [\n      Tailwind() \u002F\u002F [!code ++]\n    ]\n  }\n})\n```\n\nAnd that's it!\n\n## Updating the Tailwind CSS usage\n\nNow that we've updated our dependencies and VitePress configuration, we need to update the usage of **Tailwind CSS** in our `app.css` file. In its latest version, Tailwind CSS has moved to a CSS-based configuration, streamlining the installation process. This means we need to update our `app.css` file.\n\nFrom:\n\n```css [.vitepress\u002Ftheme\u002Fcommon\u002Fstyles\u002Fapp.css]\n@tailwind base;\n@tailwind components;\n@tailwind utilities;\n```\n\nTo:\n\n```css [.vitepress\u002Ftheme\u002Fcommon\u002Fstyles\u002Fapp.css]\n@import 'tailwindcss';\n```\n\nInstead of relying on custom CSS directives, we can now use the native directive `@import` to incorporate Tailwind CSS.\n\nThen, we migrate our configuration to the new CSS-based configuration.\n\n```css [.vitepress\u002Ftheme\u002Fcommon\u002Fstyles\u002Fapp.css]\n@config \"..\u002F..\u002F..\u002F..\u002Ftailwind.config.cjs\";\n\n@plugin \"@tailwindcss\u002Ftypography\";\n\n@source '..\u002F..\u002F..\u002F..\u002Fsrc\u002F**\u002F*.md';\n@source '..\u002F..\u002F**\u002F*.{vue,ts}';\n```\n\nIn theory, we could completely remove the current JavaScript configuration file, but since we are using the `@tailwindcss\u002Ftypography` plugin, we need to keep it.\n\n::callout{icon=\"i-ph-info-duotone\" color=\"info\"}\nAdam Wathan, the creator of Tailwind CSS, [has plans for the typography plugin](https:\u002F\u002Fx.com\u002Fadamwathan\u002Fstatus\u002F1894776336402583835), but we do not have any details yet.\n::\n\nHowever, we can still remove the `content` and `plugins` properties from the configuration file.\n\n```js [tailwind.config.cjs]\n\u002F** @type {import('tailwindcss').Config} *\u002F\nmodule.exports = {\n  content: ['.\u002Fsrc\u002F**\u002F*.md', '.\u002F.vitepress\u002Ftheme\u002F**\u002F*.{vue,ts}'], \u002F\u002F [!code --]\n  theme: {\n    extend: {\n      typography: {\n        \u002F\u002F ...\n      },\n    },\n  },\n\n  plugins: [require('@tailwindcss\u002Ftypography')], \u002F\u002F [!code --]\n}\n```\n\nAnd that's it! We are now using the latest version of **Tailwind CSS** in our **VitePress** blog!\n\nI hope you enjoyed this overview of the migration that ensures our blog stays updated to enable us to use the latest features of **Tailwind CSS**.\n",{"title":5,"description":609},"create-a-blog-with-vitepress-and-vue-js-from-scratch",{"loc":615},"series\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Fmigrating-our-vitepress-blog-to-tailwind-css-version-4","UVWqbQ65CJ7v9bNXZh9IdcqBQU6A9LP3xGMAUpAJ5l8",{"overview":623,"chapters":861},{"id":624,"title":625,"body":626,"contentId":841,"date":842,"description":843,"extension":610,"github":844,"meetTheInstructor":847,"meta":848,"navigation":260,"part":613,"path":849,"rawbody":850,"robots":613,"schemaOrg":613,"seo":851,"seriesSlug":618,"sitemap":852,"stem":855,"subtitle":856,"topics":857,"__hash__":860},"series\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch.md","Create a Blog with VitePress and Vue.js from Scratch",{"type":7,"value":627,"toc":838},[628,631,644,658,794,804,815,822,825,828,832],[10,629,630],{},"Hello and welcome! 👋",[10,632,633,634,637,638,196,640,643],{},"You're about to embark on the \"Create a ",[14,635,636],{},"Blog"," with ",[14,639,20],{},[14,641,642],{},"Vue.js"," from Scratch\" series!",[10,645,646,647,653,654,657],{},"Throughout this journey, we will construct a practical blog from the ground up using ",[34,648,651],{"href":649,"rel":650},"https:\u002F\u002Fvitepress.dev\u002F",[38],[14,652,20],{},". We will explore a range of topics from initial configuration to deploying on ",[14,655,656],{},"Cloudflare Pages",", including:",[659,660,661,686,696,702,715,721,731,741,751,763,780,786],"ul",{},[662,663,664,667,668,671,672,196,678,685],"li",{},[14,665,666],{},"Getting Started with VitePress: Project Setup and Essentials",": Learn to set up a fresh ",[14,669,670],{},"VitePress project"," by incorporating ",[34,673,676],{"href":674,"rel":675},"https:\u002F\u002Ftailwindcss.com\u002F",[38],[14,677,16],{},[34,679,682],{"href":680,"rel":681},"https:\u002F\u002Fgithub.com\u002Funplugin\u002Funplugin-vue-components",[38],[14,683,684],{},"unplugin-vue-components"," for an enhanced development process.",[662,687,688,691,692],{},[14,689,690],{},"From Default to Custom: Building a VitePress Blog Theme",": We will entirely remove the default theme and create a personalized theme. ",[693,694,695],"em",{},"You'll be surprised by its simplicity!",[662,697,698,701],{},[14,699,700],{},"Optimize Your VitePress Blog's Architecture Design",": Discover how to organize code and design your blog for scalability and maintainability.",[662,703,704,707,708,494],{},[14,705,706],{},"Implementing Blog Index with VitePress and Tailwind CSS",": Create a list of blog posts. This will introduce ",[34,709,712],{"href":710,"rel":711},"https:\u002F\u002Fvitepress.dev\u002Fguide\u002Fdata-loading",[38],[14,713,714],{},"data loaders from VitePress",[662,716,717,720],{},[14,718,719],{},"Single Blog Rendering in VitePress with Tailwind Typography",": Create a page dedicated to reading each blog post.",[662,722,723,726,727,730],{},[14,724,725],{},"Deploy VitePress Blog Globally with Cloudflare Pages",": Integrate ",[14,728,729],{},"SEO metadata"," for improved search engine visibility, eliminating the need for manual updates.",[662,732,733,736,737,740],{},[14,734,735],{},"Showcase Your GitHub Projects on Your VitePress Blog",": Develop a page to display your ",[14,738,739],{},"GitHub"," endeavors, extending the use of data loaders and demonstrating their flexibility.",[662,742,743,746,747,750],{},[14,744,745],{},"Creating Open Graph Images Automatically for Each Blog Post",": Efficiently create ",[14,748,749],{},"Open Graph images"," for each post, saving time and enhancing appeal.",[662,752,753,755,756,762],{},[14,754,725],{},": Seamlessly deploy your blog to ",[34,757,760],{"href":758,"rel":759},"https:\u002F\u002Fpages.cloudflare.com\u002F",[38],[14,761,656],{},", achieving this in just a few clicks!",[662,764,765,768,769,637,772,779],{},[14,766,767],{},"Ensure Blog Quality with Playwright Automated Testing",": Implement ",[14,770,771],{},"end-to-end testing",[34,773,776],{"href":774,"rel":775},"https:\u002F\u002Fplaywright.dev\u002F",[38],[14,777,778],{},"Playwright"," to ensure your blog functions as expected.",[662,781,782,785],{},[14,783,784],{},"An Internal Refactor for the Future Growth of our Blog",": Prepare your blog for future growth by refactoring the codebase, ensuring it remains maintainable and scalable.",[662,787,788,790,791,793],{},[14,789,5],{},": Upgrade our blog to the latest version of ",[14,792,16],{}," to leverage its new features and improvements.",[10,795,796,797,800,801,803],{},"By the conclusion, you will possess a fully operational and captivating ",[14,798,799],{},"blog",", allowing you to concentrate exclusively on producing ",[14,802,459],{},", which is paramount. Simply write and publish, as the blog will autonomously manage the rest.",[805,806,807,812],"figure",{},[808,809],"img",{"alt":810,"src":811},"Home Page of our Blog","\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Fdeploy-vitepress-blog-globally-with-cloudflare-pages\u002Fvitepress-home.png",[813,814,810],"figcaption",{},[10,816,817,818,821],{},"This series offers a detailed, step-by-step ",[14,819,820],{},"guide",". Rest assured, each aspect will be thoroughly elucidated, from selecting to implementing every feature. While each feature will be minimal and focused on the core, this does not mean we will forgo creating a visually pleasing and functional blog.",[10,823,824],{},"Should you have any inquiries, please feel free to engage in the comments section under each article.",[10,826,827],{},"I hope you find this series truly enjoyable! 🚀",[42,829,831],{"id":830},"chapters","Chapters",[833,834],"series-chapters-list",{"className":835},[836,837],"mx-auto","max-w-5xl",{"title":69,"searchDepth":83,"depth":83,"links":839},[840],{"id":830,"depth":83,"text":831},"43c95b33-041c-4108-ab98-0d21ef60ed7f","2024-10-10","Build a dynamic blog with VitePress and Vue.js from scratch. Learn setup, SEO, and deployment for a seamless blogging experience.",{"name":845,"repository":846},"garabit","barbapapazes\u002Fgarabit","I create this series because \u003Cstrong>VitePress\u003C\u002Fstrong> is way more powerful than it seems at the first glance. I was amazed by the \u003Cstrong>flexibility\u003C\u002Fstrong> and the \u003Cstrong>simplicity\u003C\u002Fstrong> of the tool while building my blog and wanted the community to know about it.",{},"\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch","---\ncontentId: 43c95b33-041c-4108-ab98-0d21ef60ed7f\ntitle: Create a Blog with VitePress and Vue.js from Scratch\nsubtitle: A new perspective on blogging with VitePress and Vue.js\ndescription: Build a dynamic blog with VitePress and Vue.js from scratch. Learn setup, SEO, and deployment for a seamless blogging experience.\ndate: 2024-10-10\ntopics:\n  - vuejs\n  - vitepress\n  - blog\ngithub:\n  name: garabit\n  repository: barbapapazes\u002Fgarabit\nmeetTheInstructor: I create this series because \u003Cstrong>VitePress\u003C\u002Fstrong> is way more powerful than it seems at the first glance. I was amazed by the \u003Cstrong>flexibility\u003C\u002Fstrong> and the \u003Cstrong>simplicity\u003C\u002Fstrong> of the tool while building my blog and wanted the community to know about it.\nseriesSlug: create-a-blog-with-vitepress-and-vue-js-from-scratch\n---\n\nHello and welcome! 👋\n\nYou're about to embark on the \"Create a **Blog** with **VitePress** and **Vue.js** from Scratch\" series!\n\nThroughout this journey, we will construct a practical blog from the ground up using [**VitePress**](https:\u002F\u002Fvitepress.dev\u002F). We will explore a range of topics from initial configuration to deploying on **Cloudflare Pages**, including:\n\n- **Getting Started with VitePress: Project Setup and Essentials**: Learn to set up a fresh **VitePress project** by incorporating [**Tailwind CSS**](https:\u002F\u002Ftailwindcss.com\u002F) and [**unplugin-vue-components**](https:\u002F\u002Fgithub.com\u002Funplugin\u002Funplugin-vue-components) for an enhanced development process.\n- **From Default to Custom: Building a VitePress Blog Theme**: We will entirely remove the default theme and create a personalized theme. _You'll be surprised by its simplicity!_\n- **Optimize Your VitePress Blog's Architecture Design**: Discover how to organize code and design your blog for scalability and maintainability.\n- **Implementing Blog Index with VitePress and Tailwind CSS**: Create a list of blog posts. This will introduce [**data loaders from VitePress**](https:\u002F\u002Fvitepress.dev\u002Fguide\u002Fdata-loading).\n- **Single Blog Rendering in VitePress with Tailwind Typography**: Create a page dedicated to reading each blog post.\n- **Deploy VitePress Blog Globally with Cloudflare Pages**: Integrate **SEO metadata** for improved search engine visibility, eliminating the need for manual updates.\n- **Showcase Your GitHub Projects on Your VitePress Blog**: Develop a page to display your **GitHub** endeavors, extending the use of data loaders and demonstrating their flexibility.\n- **Creating Open Graph Images Automatically for Each Blog Post**: Efficiently create **Open Graph images** for each post, saving time and enhancing appeal.\n- **Deploy VitePress Blog Globally with Cloudflare Pages**: Seamlessly deploy your blog to [**Cloudflare Pages**](https:\u002F\u002Fpages.cloudflare.com\u002F), achieving this in just a few clicks!\n- **Ensure Blog Quality with Playwright Automated Testing**: Implement **end-to-end testing** with [**Playwright**](https:\u002F\u002Fplaywright.dev\u002F) to ensure your blog functions as expected.\n- **An Internal Refactor for the Future Growth of our Blog**: Prepare your blog for future growth by refactoring the codebase, ensuring it remains maintainable and scalable.\n- **Migrating Our VitePress Blog to Tailwind CSS Version 4**: Upgrade our blog to the latest version of **Tailwind CSS** to leverage its new features and improvements.\n\nBy the conclusion, you will possess a fully operational and captivating **blog**, allowing you to concentrate exclusively on producing **content**, which is paramount. Simply write and publish, as the blog will autonomously manage the rest.\n\n![Home Page of our Blog](\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Fdeploy-vitepress-blog-globally-with-cloudflare-pages\u002Fvitepress-home.png)\n\nThis series offers a detailed, step-by-step **guide**. Rest assured, each aspect will be thoroughly elucidated, from selecting to implementing every feature. While each feature will be minimal and focused on the core, this does not mean we will forgo creating a visually pleasing and functional blog.\n\nShould you have any inquiries, please feel free to engage in the comments section under each article.\n\nI hope you find this series truly enjoyable! 🚀\n\n## Chapters\n\n::series-chapters-list\n---\nclass: mx-auto max-w-5xl\n---\n::\n",{"title":625,"description":843},{"loc":849,"images":853},[854],{"loc":811},"series\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch","A new perspective on blogging with VitePress and Vue.js",[858,859,799],"vuejs","vitepress","H9cubHgLKM0Siblzkwf7mDsFVYr2CLbh_ciFOpQrSVk",[862,868,874,880,886,892,899,905,911,917,923,930],{"contentId":863,"title":666,"description":864,"path":865,"part":76,"github":866,"topics":613},"b1b99d95-ac6d-4f25-a121-0851988102a2","From setup to styling with Tailwind CSS and automatic Vue imports, build your content-driven site effortlessly.","\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Fgetting-started-with-vitepress-project-setup-and-essentials",{"branch":867},"01.project-initialization",{"contentId":869,"title":690,"description":870,"path":871,"part":83,"github":872,"topics":613},"172f2a41-2f7c-44e9-855d-322adc536279","Step-by-step VitePress theme customization: guide to building a unique theme layout, adding Markdown content, and removing defaults.","\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Ffrom-default-to-custom-building-a-vitepress-blog-theme",{"branch":873},"02.the-basics-for-a-custom-theme",{"contentId":875,"title":700,"description":876,"path":877,"part":96,"github":878,"topics":613},"900d11a5-ff68-4cc9-8ace-66a5cb1577fa","Discover how to optimize your VitePress blog's architecture design with scalable solutions and efficient Vite plugin integration.","\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Foptimize-your-vitepress-blog-architecture-design",{"branch":879},"03.define-the-design-of-the-blog-architecture",{"contentId":881,"title":706,"description":882,"path":883,"part":113,"github":884,"topics":613},"4d93a3c5-f3ff-4ff6-a569-5234ef805850","Learn to create a list of blog articles using VitePress, a crucial feature for any content-centric website. Utilize data loaders to load articles.","\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Fimplementing-blog-index-with-vitepress-and-tailwind-css",{"branch":885},"04.comprehensive-guide-to-listing-blog-articles",{"contentId":887,"title":719,"description":888,"path":889,"part":127,"github":890,"topics":613},"15b9a49c-b9fb-4d76-a08d-2acaf55ff205","Enhance your VitePress blog with Tailwind Typography. Learn to render markdown beautifully with syntax highlights.","\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Fsingle-blog-rendering-in-vitepress-with-tailwind-typography",{"branch":891},"05.read-a-single-blog-article",{"contentId":893,"title":894,"description":895,"path":896,"part":141,"github":897,"topics":613},"66af9aaf-d6d3-4151-a51b-806835988340","Enhance Website Visibility: SEO Metadata and Sitemap","Enhance website traffic through strategic SEO metadata and sitemaps for improved indexing. Learn how to automate metadata generation for each page.","\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Fenhance-website-visibility-seo-metadata-and-sitemap",{"branch":898},"06.seo-metadata-and-sitemap",{"contentId":900,"title":735,"description":901,"path":902,"part":152,"github":903,"topics":613},"a4a933b8-07a5-4587-ad54-c3f9e30cbf45","Enhance your VitePress blog with GitHub projects. Learn API data retrieval and how to display your projects on your blog.","\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Fshowcase-your-github-projects-on-your-vitepress-blog",{"branch":904},"07.showcase-your-github-projects",{"contentId":906,"title":745,"description":907,"path":908,"part":158,"github":909,"topics":613},"c76a349e-a495-4890-ab05-3e8b6bb90add","Learn how to dynamically generate Open Graph images for each blog post, enhancing the visual appeal when sharing content on social media.","\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Fcreating-open-graph-images-automatically-for-each-blog-post",{"branch":910},"08.automatically-generated-open-graph-images",{"contentId":912,"title":725,"description":913,"path":914,"part":302,"github":915,"topics":613},"c05ae463-c5ae-4c43-872d-bb05263c7f74","Deploy the blog to Cloudflare Pages for global accessibility. Discover how to deploy the blog to Cloudflare Pages and share it worldwide with ease.","\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Fdeploy-vitepress-blog-globally-with-cloudflare-pages",{"branch":916},"09.share-the-blog-globally",{"contentId":918,"title":767,"description":919,"path":920,"part":307,"github":921,"topics":613},"aa5392e0-6287-4673-9365-34313f0af1fa","Enhance web development with Playwright-induced automated testing. Elevate blog quality through comprehensive end-to-end and SEO tests.","\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Fensure-blog-quality-with-playwright-automated-testing",{"branch":922},"10.automate-testing",{"contentId":924,"title":925,"description":926,"path":927,"part":558,"github":928,"topics":613},"5b1b6117-14f0-4f1d-ba13-5b3583f341bf","An Internal Refactor for the Future Growth of Our Blog","Prepare your blog for future growth by refactoring the codebase to ensure it remains maintainable and scalable.","\u002Fseries\u002Fcreate-a-blog-with-vitepress-and-vue-js-from-scratch\u002Fan-internal-refactor-for-the-future-growth-of-our-blog",{"branch":929},"11.internal-refactor",{"contentId":607,"title":5,"description":609,"path":615,"part":564,"github":931,"topics":613},{"branch":612},1795016693138]