Skip to content

Commit f968ffc

Browse files
committed
Added feature to redefine custom files pathes.
#31
1 parent 3708cc3 commit f968ffc

File tree

6 files changed

+41
-6
lines changed

6 files changed

+41
-6
lines changed

_config.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,21 @@ override: false
1212
cache:
1313
enable: true
1414

15+
# Redefine custom file pathes. Introduced in NexT v6.0.2.
16+
# If commented, will be used default custom file pathes.
17+
# For example, you want to put your custom styles file
18+
# outside theme directory in root `source/_data`, set
19+
# `styles: ../../../../../source/_data/styles.styl`
20+
#custom_file_path:
21+
#head: ../../../../../source-lang/_data/head.swig
22+
#header: ../../../../source-lang/_data/header.swig
23+
#sidebar: ../../../../source-lang/_data/sidebar.swig
24+
25+
#styles: ../../../../../source-lang/_data/styles.styl
26+
#mixins: ../../../../../source-lang/_data/mixins.styl
27+
#variables: ../../../../../source-lang/_data/variables.styl
28+
29+
1530
# ---------------------------------------------------------------
1631
# Site Information Settings
1732
# ---------------------------------------------------------------

layout/_macro/sidebar.swig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,12 @@
135135
</div>
136136
{% endif %}
137137

138-
{% include '../_custom/sidebar.swig' %}
138+
{% if theme.custom_file_path.sidebar %}
139+
{% set custom_sidebar = theme.custom_file_path.sidebar %}
140+
{% else %}
141+
{% set custom_sidebar = '../_custom/sidebar.swig' %}
142+
{% endif %}
143+
{% include custom_sidebar %}
139144
</div>
140145
</section>
141146

layout/_partials/head/head.swig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,9 @@
131131
};
132132
</script>
133133

134-
{% include './custom-head.swig' %}
134+
{% if theme.custom_file_path.head %}
135+
{% set custom_head = theme.custom_file_path.head %}
136+
{% else %}
137+
{% set custom_head = '../../_custom/head.swig' %}
138+
{% endif %}
139+
{% include custom_head %}

layout/_partials/header.swig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,9 @@
9090
{% endif %}
9191
</nav>
9292

93-
{% include '../_custom/header.swig' %}
93+
{% if theme.custom_file_path.header %}
94+
{% set custom_header = theme.custom_file_path.header %}
95+
{% else %}
96+
{% set custom_header = '../_custom/header.swig' %}
97+
{% endif %}
98+
{% include custom_header %}

source/css/main.styl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,13 @@
33

44

55
$scheme = hexo-config('scheme') ? hexo-config('scheme') : 'Muse';
6-
$variables = base $scheme custom;
7-
$mixins = base $scheme custom;
6+
7+
$custom_styles = hexo-config('custom_file_path.styles') ? hexo-config('custom_file_path.styles') : custom;
8+
$custom_mixins = hexo-config('custom_file_path.mixins') ? hexo-config('custom_file_path.mixins') : custom;
9+
$custom_variables = hexo-config('custom_file_path.variables') ? hexo-config('custom_file_path.variables') : custom;
10+
11+
$variables = base $scheme $custom_variables;
12+
$mixins = base $scheme $custom_mixins;
813

914

1015

@@ -42,4 +47,4 @@ for $mixin in $mixins
4247

4348
// Custom Layer
4449
// --------------------------------------------------
45-
@import "_custom/custom";
50+
@import "_custom/" + $custom_styles;

0 commit comments

Comments
 (0)