get deployed docs to use minified assets

This commit is contained in:
Kevin Ross 2015-12-23 15:58:24 -06:00
parent 1b384ebede
commit c4a49695ee
3 changed files with 19 additions and 7 deletions

View File

@ -23,7 +23,7 @@
<script src="{{ site.baseurl }}/assets/js/vendor/tether.min.js"></script> <script src="{{ site.baseurl }}/assets/js/vendor/tether.min.js"></script>
{% if site.github %} {% if site.data.minified %}
<script src="{{ site.baseurl }}/dist/js/{{ site.data.name }}.min.js"></script> <script src="{{ site.baseurl }}/dist/js/{{ site.data.name }}.min.js"></script>
<script src="{{ site.baseurl }}/assets/js/docs.min.js"></script> <script src="{{ site.baseurl }}/assets/js/docs.min.js"></script>
{% else %} {% else %}

View File

@ -18,7 +18,7 @@
<link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons"> <link rel="stylesheet" href="https://fonts.googleapis.com/icon?family=Material+Icons">
<!-- Material Design for Bootstrap customization for Documentation (consider Documentation the application) --> <!-- Material Design for Bootstrap customization for Documentation (consider Documentation the application) -->
{% if site.github %} {% if site.data.minified %}
<link href="{{ site.baseurl }}/assets/css/docs.min.css" rel="stylesheet"> <link href="{{ site.baseurl }}/assets/css/docs.min.css" rel="stylesheet">
{% else %} {% else %}
<link href="{{ site.baseurl }}/assets/css/docs.css" rel="stylesheet"> <link href="{{ site.baseurl }}/assets/css/docs.css" rel="stylesheet">

View File

@ -6,6 +6,15 @@ module Variables
safe true safe true
def generate(site) def generate(site)
# indicate to use min or development assets
baseurl = site.config['baseurl']
minified = true
if baseurl.eql? ''
minified = false
end
site.data['minified'] = minified
metadata_files = { metadata_files = {
'bower' => '../bower.json', 'bower' => '../bower.json',
'package' => '../package.json', 'package' => '../package.json',
@ -30,20 +39,23 @@ module Variables
# fabricate the archive and release links based on the site.repo and version # fabricate the archive and release links based on the site.repo and version
jekyll_config = Jekyll.configuration({}) repo = site.config['repo']
repo = jekyll_config['repo']
site.data['download'] = { site.data['download'] = {
'source' => "#{repo}/archive/v#{version}.zip", 'source' => "#{repo}/archive/v#{version}.zip",
'dist' => "#{repo}/releases/download/v#{version}/#{name}-#{version}-dist.zip" 'dist' => "#{repo}/releases/download/v#{version}/#{name}-#{version}-dist.zip"
} }
site.data['cdn'] = { site.data['cdn'] = {
'jquery' => jekyll_config['cdn']['jquery'].gsub(/VERSION/, jquery_version), 'jquery' => site.config['cdn']['jquery'].gsub(/VERSION/, jquery_version),
'bootstrap' => jekyll_config['cdn']['bootstrap'].gsub(/VERSION/, bootstrap_version) 'bootstrap' => site.config['cdn']['bootstrap'].gsub(/VERSION/, bootstrap_version)
} }
# #
# puts "\n---------------------" puts "\n---------------------"
puts "site.config: #{site.config.to_yaml}"
puts "baseurl: #{baseurl}"
puts "minified: #{site.data['minified']}"
# puts "site: #{site.to_yaml}"
# puts site.data[:package]['version'] # puts site.data[:package]['version']
# puts site.data.to_yaml # puts site.data.to_yaml
# puts repo # puts repo