[devdocsgjs/main: 39/239] Add Vite documentation




commit 8975e9c738ea0ede1c5e05e70c4330672bf50634
Author: Simon Legner <Simon Legner gmail com>
Date:   Sat Dec 4 00:16:06 2021 +0100

    Add Vite documentation
    
    https://vitejs.dev/

 assets/javascripts/news.json                       |   4 +++
 .../javascripts/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(-)
---
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: <a href=\"/vite/\">Vite</a>"
+  ],
   [
     "2021-11-29",
     "New documentation: <a href=\"/i3/\">i3</a>"
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 '<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'
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
+      &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
diff --git a/public/icons/docs/vite/16.png b/public/icons/docs/vite/16.png
new file mode 100644
index 00000000..90ffa786
Binary files /dev/null and b/public/icons/docs/vite/16.png differ
diff --git a/public/icons/docs/vite/16 2x png b/public/icons/docs/vite/16 2x png
new file mode 100644
index 00000000..375fb680
Binary files /dev/null and b/public/icons/docs/vite/16 2x png differ
diff --git a/public/icons/docs/vite/SOURCE b/public/icons/docs/vite/SOURCE
new file mode 100644
index 00000000..f1fe46ee
--- /dev/null
+++ b/public/icons/docs/vite/SOURCE
@@ -0,0 +1 @@
+https://vitejs.dev/logo.svg


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]