From 8975e9c738ea0ede1c5e05e70c4330672bf50634 Mon Sep 17 00:00:00 2001 From: Simon Legner Date: Sat, 4 Dec 2021 00:16:06 +0100 Subject: [PATCH] Add Vite documentation https://vitejs.dev/ --- assets/javascripts/news.json | 4 +++ .../templates/pages/about_tmpl.coffee | 5 +++ lib/docs/filters/vue/clean_html.rb | 7 +++- lib/docs/scrapers/vite.rb | 30 ++++++++++++++++++ public/icons/docs/vite/16.png | Bin 0 -> 703 bytes public/icons/docs/vite/16@2x.png | Bin 0 -> 1376 bytes public/icons/docs/vite/SOURCE | 1 + 7 files changed, 46 insertions(+), 1 deletion(-) create mode 100644 lib/docs/scrapers/vite.rb create mode 100644 public/icons/docs/vite/16.png create mode 100644 public/icons/docs/vite/16@2x.png create mode 100644 public/icons/docs/vite/SOURCE diff --git a/assets/javascripts/news.json b/assets/javascripts/news.json index d5b52149..a8217c2b 100644 --- a/assets/javascripts/news.json +++ b/assets/javascripts/news.json @@ -1,4 +1,8 @@ [ + [ + "2021-12-04", + "New documentation: Vite" + ], [ "2021-11-29", "New documentation: i3" diff --git a/assets/javascripts/templates/pages/about_tmpl.coffee b/assets/javascripts/templates/pages/about_tmpl.coffee index 6146bdbc..e5349e9c 100644 --- a/assets/javascripts/templates/pages/about_tmpl.coffee +++ b/assets/javascripts/templates/pages/about_tmpl.coffee @@ -851,6 +851,11 @@ credits = [ '2010-2018 Mitchell Hashimoto', 'MPL', 'https://raw.githubusercontent.com/mitchellh/vagrant/master/website/LICENSE.md' + ], [ + 'Vite', + '2019–present, Yuxi (Evan) You and Vite contributors', + 'MIT', + 'https://github.com/vitejs/vite/blob/main/LICENSE' ], [ 'Vue Router', '2013-present Evan You', diff --git a/lib/docs/filters/vue/clean_html.rb b/lib/docs/filters/vue/clean_html.rb index e05c081b..754d3789 100644 --- a/lib/docs/filters/vue/clean_html.rb +++ b/lib/docs/filters/vue/clean_html.rb @@ -2,7 +2,12 @@ module Docs class Vue class CleanHtmlFilter < Filter def call - @doc = at_css(version == '3' ? 'main' : '.content') + if current_url.host == 'vitejs.dev' + return '

Vite

' if root_page? + @doc = at_css('.content > div') + else + @doc = at_css(version == '3' ? 'main' : '.content') + end at_css('h1').content = 'Vue.js' if root_page? doc.child.before('

Vue.js API

') if slug == 'api/' || slug == 'api/index' diff --git a/lib/docs/scrapers/vite.rb b/lib/docs/scrapers/vite.rb new file mode 100644 index 00000000..4af8b895 --- /dev/null +++ b/lib/docs/scrapers/vite.rb @@ -0,0 +1,30 @@ +module Docs + class Vite < UrlScraper + self.name = 'Vite' + self.slug = 'vite' + self.type = 'simple' + self.links = { + home: 'https://vitejs.dev/', + code: 'https://github.com/vitejs/vite' + } + + options[:container] = 'main' + options[:root_title] = 'Vite' + + options[:attribution] = <<-HTML + © 2019–present, Yuxi (Evan) You and Vite contributors
+ Licensed under the MIT License. + HTML + + version do + self.release = '2.6.14' + self.base_url = 'https://vitejs.dev/' + self.initial_paths = %w(guide/) + html_filters.push 'vue/entries_v3', 'vue/clean_html' + end + + def get_latest_version(opts) + get_npm_version('vite', opts) + end + end +end diff --git a/public/icons/docs/vite/16.png b/public/icons/docs/vite/16.png new file mode 100644 index 0000000000000000000000000000000000000000..90ffa786580230c8893595dd7e2dcff8e5ce8521 GIT binary patch literal 703 zcmV;w0zmzVP)#f#)51osr9~fni|_D0&v!USut+Ht)A-`8 zgH$zsvI;*{jh}ojR&}=qbH=s-wcM0wJzK>19Q?JukPlDBQK}fF@TMlu{1q1{*x!@kWe z01Y4(6Mlh1qwRw2LL`?!IyT8<$vn~9_+iYHNyrt=hi-~2fCzp`%LVnw^4Jy1dFYr^@*ta7N-k4G#2zKydjrGK@9ur7T?sPtZU7L@XlHDP@3sRI zpX!L{pBauv(NiH=Ahp)t^M44AUKdlABigL|gPI>18$3YBQ5_AvV&tC!fFj8?%jI3f zpJIG?A4W1fZF*YULRqoUA;80Wwa4&OmnlJ)qOmS6F8!APpr^*~*K$;NKg9Zm_rhB! lWBg5^`{D>1C5yoTKLKAr4m*W8pD+Lb002ovPDHLkV1k{aJRbl6 literal 0 HcmV?d00001 diff --git a/public/icons/docs/vite/16@2x.png b/public/icons/docs/vite/16@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..375fb680ed60b7ae63a9e689af5c69c88989ff62 GIT binary patch literal 1376 zcmV-m1)utfP)kpI$#FBt9K@23NrZp;wMn!=bLySg9s2Yfgq68I{YO085 zFa!*en4l7kKUI+^5)&|@5D<|>1=_PMKeYv+h)@jD>z{YGGqYo6xjnY!uDvU$FPVFD zd$aHRzPIn~%n>e=>DDKLD6qE40vvxWqw9}S>gPlQsH(D5W- zTP18e586g@IB>+V!D3NP!0j^%5a+w0MH#dmaDkuC}5ZKg$dR&;!!Koi`nt3(-@OQqQGcyP%eiUPQoHuf}Ri;sp1lJvBs=RyZGfynh89`1$6%!2%;NW5!$1Z5IOz; zY!S*xsJXcciLNVC_gj)`p4>`_toMTF*XT`5;=T)=pfS=q4cjh)N));kz39%#2o3AF zs0)-c3}0;Ai+FdbSNW0FGP*t-CTH*rc+3*0<`RkX>b0w)x3?53Ug)YS3A7=^&!){l ztE;{=rJihBk`8=80xN6iH!htw4YyrLXi_)FSCbOghp$f8u|a2uPew$RQ@IBdYZ z+F{GN#97PNiXM?MMGa{S@yM@Lh2*IE*a3wmK7i~$LR!xXgyE$2zq{-QL;f##$0 zuyfA`5Q#h&+^BD^Uz}RYlz#XAZ|UGAorq%jcx!kE7I1~h{!OaBsmAp|>Vb7*ubY8m zEe|0cy~@4L6?%dR_R3)K*7*2j^Bpm2#C~WAwANLp zNHIyvW^SY2%Szy}_o;zPU2FC0hLVx{aI)2?pXjMST)QCM?tv8-HRF#XRfwIv)>FT0=1;UWmzX*IFEIA` zY#j=8>Sm@e-rXY{^QI)zo(>mu!?b#;%OxJmmB5^h6l02(`BI)dZ0hy7f)9y+vB(a5 z%q8}xHX8?VDE87&VhxEv802t=mKXvsJ2B}u?uby^e@4LAj34QH4QvA8PbSz({2%u9 i1ReZlsxG;d82