浏览代码

make CSS generation optional

Alexey Shpakovsky 11 年之前
父节点
当前提交
0fc7058ae7
共有 1 个文件被更改,包括 5 次插入3 次删除
  1. 5 3
      bb.sh

+ 5 - 3
bb.sh

@@ -178,8 +178,9 @@ global_variables() {
     # extra content to add just after we open the <body> tag
     # extra content to add just after we open the <body> tag
     # and before the actual blog content
     # and before the actual blog content
     body_begin_file=""
     body_begin_file=""
-    # CSS files to include on every page
-    css_include=('main.css' 'blog.css')
+    # CSS files to include on every page, f.ex. css_include=('main.css' 'blog.css')
+    # leave empty to use generated
+    css_include=()
 
 
     # Localization and i18n
     # Localization and i18n
     # "Comments?" (used in twitter link after every post)
     # "Comments?" (used in twitter link after every post)
@@ -846,6 +847,7 @@ delete_includes() {
 create_css() {
 create_css() {
     # To avoid overwriting manual changes. However it is recommended that
     # To avoid overwriting manual changes. However it is recommended that
     # this function is modified if the user changes the blog.css file
     # this function is modified if the user changes the blog.css file
+    [ $css_include ] && return || css_include=('main.css' 'blog.css')
     if [[ ! -f "blog.css" ]]; then 
     if [[ ! -f "blog.css" ]]; then 
         # blog.css directives will be loaded after main.css and thus will prevail
         # blog.css directives will be loaded after main.css and thus will prevail
         echo '#title{font-size: x-large;}
         echo '#title{font-size: x-large;}
@@ -1023,8 +1025,8 @@ do_main() {
     [[ "$1" == "reset" ]] &&
     [[ "$1" == "reset" ]] &&
         reset && exit
         reset && exit
 
 
-    create_includes
     create_css
     create_css
+    create_includes
     [[ "$1" == "post" ]] && write_entry "$@"
     [[ "$1" == "post" ]] && write_entry "$@"
     [[ "$1" == "rebuild" ]] && rebuild_all_entries
     [[ "$1" == "rebuild" ]] && rebuild_all_entries
     [[ "$1" == "delete" ]] && rm "$2" &> /dev/null 
     [[ "$1" == "delete" ]] && rm "$2" &> /dev/null