diff --git a/README.md b/README.md index 1d89a2b..6ca37f8 100644 --- a/README.md +++ b/README.md @@ -39,5 +39,35 @@ stylus: - **basePath** - Base path from which sourcemap and all sources are relative (default: `.`) - **plugins** - Stylus plugin(s) (default: `nib`) +## Setting Stylus variables + +It is possible to set variables that can be used in Stylus. +The purpose of setting variable is to avoid direct modification of the Sylus code, +and thus to make themes more generic + +For example, instead of hardcoding: +```stylus +div + color #FFCC44 +``` + +You can refer to a variable: +```stylus +div + color convert(hexo-config("color")) +``` + +And in your theme's configuration, you can define this variable: +```yml +color: "#FFCC44" +``` +(The "convert" function above is here to convert the string into an actual stylus color) + +You can also use the theme_config variable in the main `_config.yml`: +```yml +theme_config: + color: "#FFCC44" +``` + [Stylus]: http://stylus-lang.com/ [nib]: http://stylus.github.io/nib/