Przeglądaj źródła

Add Vite documentation

https://vitejs.dev/
Simon Legner 4 lat temu
rodzic
commit
8975e9c738

+ 4 - 0
assets/javascripts/news.json

@@ -1,4 +1,8 @@
 [
+  [
+    "2021-12-04",
+    "New documentation: <a href=\"/vite/\">Vite</a>"
+  ],
   [
     "2021-11-29",
     "New documentation: <a href=\"/i3/\">i3</a>"

+ 5 - 0
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',

+ 6 - 1
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 '<h1>Vite</h1>' 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('<h1>Vue.js API</h1>') if slug == 'api/' || slug == 'api/index'

+ 30 - 0
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
+      &copy; 2019–present, Yuxi (Evan) You and Vite contributors<br>
+      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

BIN
public/icons/docs/vite/16.png


BIN
public/icons/docs/vite/16@2x.png


+ 1 - 0
public/icons/docs/vite/SOURCE

@@ -0,0 +1 @@
+https://vitejs.dev/logo.svg