Browse Source

Write filesizes to config vs installation

as we need it on frontpage too
Kevin van Zonneveld 9 years ago
parent
commit
13d339d7df
3 changed files with 22 additions and 19 deletions
  1. 10 3
      website/_config.yml
  2. 2 6
      website/src/guide/installation.md
  3. 10 10
      website/update.js

+ 10 - 3
website/_config.yml

@@ -2,6 +2,12 @@
 ## Docs: http://zespia.tw/hexo/docs/configuration.html
 ## Source: https://github.com/tommy351/hexo/
 
+# Uppy versions, auto updated by update.js
+uppy_version: 0.0.1
+uppy_dev_size: "99999"
+uppy_min_size: "16.62"
+uppy_gz_size: "99999"
+
 # Site
 title: Uppy
 subtitle: "Almost as cute as a puppy"
@@ -11,9 +17,10 @@ logo_icon: /images/emojis/dog.png
 description: >
   Uppy is (going to be) an uploader written in ES6 JavaScript with a plugin-based architecture, making
   it very extensible. Out of the box it supports tapping into Dropbox, Instagram, Local files. It
-  has support for resumable file uploads via tus.io, and adding encoding backends.
-  Uppy is brought to you by the people behind Transloadit and as such has first class
-  support for adding their uploading and encoding backend, but this is opt-in.
+  has support for resumable file uploads via [tus.io](http://tus.io), and adding encoding backends.
+  Uppy is brought to you by the people behind [Transloadit](https://transloadit.com) and as such has first class
+  support for adding their uploading and encoding backend, but this is opt-in, and you can just as easily
+  roll your own.
 author: Transloadit
 email: uppybot@uppyjs.io
 language: English

+ 2 - 6
website/src/guide/installation.md

@@ -2,10 +2,6 @@
 title: Installation
 type: guide
 order: 0
-uppy_version: 0.0.1
-dev_size: "16.62"
-min_size: "undefined"
-gz_size: "undefined"
 ---
 
 > **Compatibility Note:** Uppy does not support IE8 and below.
@@ -17,12 +13,12 @@ Simply download and include with a script tag. `Uppy` will be registered as a gl
 <div id="downloads">
 <a class="button" href="/js/uppy.js" download>Development Version</a><span class="light info">With full warnings and debug mode</span>
 
-<a class="button" href="/js/uppy.min.js" download>Production Version</a><span class="light info">Warnings stripped, {{gz_size}}kb min+gzip</span>
+<a class="button" href="/js/uppy.min.js" download>Production Version</a><span class="light info">Warnings stripped, {{config.uppy_gz_size}}kb min+gzip</span>
 </div>
 
 ### CDN
 
-Available on [assets.transloadt.com](//assets.transloadt.com/uppy/{{uppy_version}}/uppy.min.js) or [cdnjs](//cdnjs.cloudflare.com/ajax/libs/uppy/{{uppy_version}}/uppy.min.js) (takes some time to sync so the latest version might not be available yet).
+Available on [assets.transloadt.com](//assets.transloadt.com/uppy/{{config.uppy_version}}/uppy.min.js) or [cdnjs](//cdnjs.cloudflare.com/ajax/libs/uppy/{{config.uppy_version}}/uppy.min.js) (takes some time to sync so the latest version might not be available yet).
 
 ### CSP-compliant build
 

+ 10 - 10
website/update.js

@@ -1,9 +1,9 @@
 var fs            = require('fs')
 var version       = require('../package.json').version
 var themeconfPath = 'themes/uppy/_config.yml'
-var installPath   = 'src/guide/installation.md'
+var configPath    = '_config.yml'
 var themeconfig   = fs.readFileSync(themeconfPath, 'utf-8')
-var installation  = fs.readFileSync(installPath, 'utf-8')
+var config        = fs.readFileSync(configPath, 'utf-8')
 
 // fs.writeFileSync('themes/uppy/layout/partials/DESIGNGOALS.md', fs.readFileSync('../DESIGNGOALS.md', 'utf-8'));
 
@@ -13,21 +13,21 @@ fs.writeFileSync(
 )
 
 var sizes = {
-  // min: 'uppy.min.js',
-  // gz: 'uppy.min.js.gz',
-  dev: './uppy.js'
+  min: '../dist/uppy.min.js',
+  // gz : '../dist/uppy.min.js.gz',
+  // dev: '../dist/uppy.js'
 }
 
 for (var file in sizes) {
-  var filesize = fs.statSync('../dist/' + sizes[file], 'utf-8').size
+  var filesize = fs.statSync(sizes[file], 'utf-8').size
   sizes[file] = (filesize / 1024).toFixed(2)
 }
 
 fs.writeFileSync(
-  installPath,
-  installation
+  configPath,
+  config
     .replace(/uppy_version: .*/, 'uppy_version: ' + version)
-    .replace(/(\w+)_size:.*/g, function (m, p1) {
-      return p1 + '_size: "' + sizes[p1] + '"'
+    .replace(/uppy_(\w+)_size:.*/g, function (m, p1) {
+      return 'uppy_' + p1 + '_size: "' + (sizes[p1] || 99999 ) + '"'
     })
 )