提交 cb0f68bc 编写于 作者: C codecalm

site build fixes

上级 af7d9d66
......@@ -20,9 +20,12 @@ const gulp = require('gulp'),
fs = require('fs'),
path = require('path'),
YAML = require('yaml'),
yargs = require('yargs/yargs'),
cp = require('child_process'),
pkg = require('./package.json'),
year = new Date().getFullYear();
year = new Date().getFullYear(),
argv = yargs(process.argv).argv;
let BUILD = false,
distDir = './.tmp',
......@@ -233,7 +236,13 @@ gulp.task('watch-jekyll', (cb) => {
*/
gulp.task('build-jekyll', (cb) => {
var env = Object.create(process.env);
env.JEKYLL_ENV = 'production';
if(argv.preview) {
env.JEKYLL_ENV = 'preview';
}
else {
env.JEKYLL_ENV = 'production';
}
return spawn('bundle', ['exec', 'jekyll', 'build', '--destination', demoDir, '--trace'], { env: env, stdio: 'inherit' })
.on('close', cb);
......
......@@ -5,6 +5,7 @@
"scripts": {
"start": "gulp start",
"build": "gulp build",
"preview": "gulp build --preview",
"svg-optimize": "svgo -f svg/brand --pretty",
"unused-files": "node build/unused-files.js",
"release": "release-it",
......@@ -69,7 +70,8 @@
"rollup-plugin-babel": "^4.4.0",
"vinyl-buffer": "^1.0.1",
"vinyl-source-stream": "^2.0.0",
"yaml": "^1.10.0"
"yaml": "^1.10.0",
"yargs": "^16.1.0"
},
"dependencies": {
"@fullcalendar/core": "^5.3.1",
......
{% assign icons = include.icons %}
{% assign limit = 20 %}
{% if jekyll.environment == 'production' %}
{% if jekyll.environment != 'development' %}
{% assign limit = null %}
{% endif %}
<div class="card">
......
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-113467793-4"></script>
<script async src="https://www.googletagmanager.com/gtag/js?id=G-SWJ7MQPBQJ"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-113467793-4');
gtag('config', 'G-SWJ7MQPBQJ');
</script>
\ No newline at end of file
......@@ -9,16 +9,16 @@
{% for lib in site.data.libs.css %}
{% if libs contains lib[0] %}
{% for file in lib[1] %}
<link href="{% if file contains 'http://' or file contains 'https://' %}{{ file }}{% else %}{{ site.base }}/{% if jekyll.environment == 'production' %}dist/libs{% else %}node_modules{% endif %}/{% if jekyll.environment == 'production' %}{{ file | replace: '@', '' }}{% else %}{{ file }}{% endif %}{% if site.preview %}?{{ site.time | date: '%s' }}{% endif %}{% endif %}" rel="stylesheet"/>
<link href="{% if file contains 'http://' or file contains 'https://' %}{{ file }}{% else %}{{ site.base }}/{% if jekyll.environment != 'development' %}dist/libs{% else %}node_modules{% endif %}/{% if jekyll.environment != 'development' %}{{ file | replace: '@', '' }}{% else %}{{ file }}{% endif %}{% if site.preview %}?{{ site.time | date: '%s' }}{% endif %}{% endif %}" rel="stylesheet"/>
{% endfor %}
{% endif %}
{% endfor %}
{% endif %}
<link href="{{ site.base }}/dist/css/tabler{% if jekyll.environment == 'production' %}.min{% endif %}.css{% if site.preview %}?{{ site.time | date: '%s' }}{% endif %}" rel="stylesheet"/>
<link href="{{ site.base }}/dist/css/tabler{% if jekyll.environment != 'development' %}.min{% endif %}.css{% if site.preview %}?{{ site.time | date: '%s' }}{% endif %}" rel="stylesheet"/>
{% for plugin in site.tabler-plugins %}
<link href="{{ site.base }}/dist/css/{{ plugin }}{% if jekyll.environment == 'production' %}.min{% endif %}.css{% if site.preview %}?{{ site.time | date: '%s' }}{% endif %}" rel="stylesheet"/>
<link href="{{ site.base }}/dist/css/{{ plugin }}{% if jekyll.environment != 'development' %}.min{% endif %}.css{% if site.preview %}?{{ site.time | date: '%s' }}{% endif %}" rel="stylesheet"/>
{% endfor %}
<link href="{{ site.base }}/dist/css/demo{% if jekyll.environment == 'production' %}.min{% endif %}.css{% if site.preview %}?{{ site.time | date: '%s' }}{% endif %}" rel="stylesheet"/>
\ No newline at end of file
<link href="{{ site.base }}/dist/css/demo{% if jekyll.environment != 'development' %}.min{% endif %}.css{% if site.preview %}?{{ site.time | date: '%s' }}{% endif %}" rel="stylesheet"/>
\ No newline at end of file
......@@ -4,14 +4,14 @@
{% for lib in site.data.libs.js %}
{% if libs contains lib[0] or site.data.libs.global-libs contains lib[0] %}
{% for file in lib[1] %}
<script src="{% if file contains 'http://' or file contains 'https://' %}{{ file }}{% else %}{{ site.base }}/{% if jekyll.environment == 'production' %}dist/libs{% else %}node_modules{% endif %}/{% if jekyll.environment == 'production' %}{{ file | replace: '@', '' }}{% else %}{{ file }}{% endif %}{% if site.preview %}?{{ site.time | date: '%s' }}{% endif %}{% endif %}"></script>
<script src="{% if file contains 'http://' or file contains 'https://' %}{{ file }}{% else %}{{ site.base }}/{% if jekyll.environment != 'development' %}dist/libs{% else %}node_modules{% endif %}/{% if jekyll.environment != 'development' %}{{ file | replace: '@', '' }}{% else %}{{ file }}{% endif %}{% if site.preview %}?{{ site.time | date: '%s' }}{% endif %}{% endif %}"></script>
{% endfor %}
{% endif %}
{% endfor %}
<!-- Tabler Core -->
<script src="{{ site.base }}/dist/js/tabler{% if jekyll.environment == 'production' %}.min{% endif %}.js{% if site.preview %}?{{ site.time | date: '%s' }}{% endif %}"></script>
<script src="{{ site.base }}/dist/js/tabler{% if jekyll.environment != 'development' %}.min{% endif %}.js{% if site.preview %}?{{ site.time | date: '%s' }}{% endif %}"></script>
{% removeemptylines %}
......
......@@ -3,13 +3,17 @@
{% assign title = page.title | default: layout.title %}
<html lang="en"{% if page.rtl %} dir="rtl" {% endif %}>
<head>
{% if jekyll.environment == 'preview' %}
{% include layout/analytics.html %}
{% endif %}
<meta charset="utf-8"/>
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover"/>
<meta http-equiv="X-UA-Compatible" content="ie=edge"/>
<title>{% if title %}{{ title }} - {% endif %}{% if site.title %}{{ site.title }} - {% endif %}{{ site.description }}</title>
{% if jekyll.environment == 'production' %}
{% if jekyll.environment != 'development' %}
<link rel="preconnect" href="https://fonts.gstatic.com/" crossorigin>
<meta name="msapplication-TileColor" content="{{ site.data.colors.blue }}"/>
......@@ -25,10 +29,6 @@
<link rel="icon" href="{{ site.base }}/favicon.ico" type="image/x-icon"/>
<link rel="shortcut icon" href="{{ site.base }}/favicon.ico" type="image/x-icon"/>
{% if site.preview %}
{% include layout/analytics.html %}
{% endif %}
{% if page.description %}
<meta name="description" content="{{ page.description | escape }}"/>
{% endif %}
......@@ -37,7 +37,6 @@
{% endif %}
{% include layout/css.html %}
<style>
body {
display: none;
......
Jekyll::Hooks.register :site, :post_read do |site|
if Jekyll.env == 'production'
if Jekyll.env != 'development'
site.pages.delete_if do |page|
if page.data['tmp']
true
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册