jekyll项目开发
2015-10-30 15:42
239 查看
1. jekyll serve
a built-in development server that will allow you to preview what the generated site will look like in your browser locally.
运行此命令,可以在本地预览将要生成的网站的样子。
2. _config.yml
Many configuration options can either be specified as flags on the command line, or alternatively (and more commonly) they can be specified in the _config.yml file at the root of the source directory. Jekyll will automatically use the options from this file
when run.
3. _includes
These are the partials that can be mixed and matched by your layouts and posts to facilitate reuse. 使用方法 {% include file.ext %}
该文件夹下存放可以重复使用的部件。
4. specify site-wide defaults using the defaults key in the _config.yml
Often times, you will find that you are repeating a lot of configuration options. Setting the same layout in each file, adding the same category - or categories - to a post, etc. You can even add custom variables like author names, which might be the same
for the majority of posts on your blog.
为了避免重复设置,Jekyll提供了一种方法在网站配置里 (_config.yml)设置这些默认设置。关键词 defaults 包含一组 scope/values 对,定义一个指定文件路径下默认设置是什么,作为可选项,可以指定该路径下特定的文件类型。
比如,你希望给你网站上所有页面和文章都使用叫 default 的布局。则添加以下代码:
此外,defaults 可以包含多个 scope/values 对。
并且,你可以在具体的 post 或 page 文件里对这些设置重写。
5. _site 此目录下默认用来放置Jekyll生成的网站。最好把此文件夹添加到你的 .gitignore 文件里。运行下面代码。
6. 添加 images, fonts 或其他 CSS库
官网上在 structure 这一章节里讲到,除了列举出的默认的文件夹,项目根目录下的所有其他 directory 和 file(如 CSS 和 images 文件夹,favicon.ico 文件,等)都将逐一被直接复制到生成的网站下。所以,如果希望添加web font,如下:
7. When to use a post, a page, or a collection
a built-in development server that will allow you to preview what the generated site will look like in your browser locally.
运行此命令,可以在本地预览将要生成的网站的样子。
2. _config.yml
Many configuration options can either be specified as flags on the command line, or alternatively (and more commonly) they can be specified in the _config.yml file at the root of the source directory. Jekyll will automatically use the options from this file
when run.
3. _includes
These are the partials that can be mixed and matched by your layouts and posts to facilitate reuse. 使用方法 {% include file.ext %}
该文件夹下存放可以重复使用的部件。
4. specify site-wide defaults using the defaults key in the _config.yml
Often times, you will find that you are repeating a lot of configuration options. Setting the same layout in each file, adding the same category - or categories - to a post, etc. You can even add custom variables like author names, which might be the same
for the majority of posts on your blog.
为了避免重复设置,Jekyll提供了一种方法在网站配置里 (_config.yml)设置这些默认设置。关键词 defaults 包含一组 scope/values 对,定义一个指定文件路径下默认设置是什么,作为可选项,可以指定该路径下特定的文件类型。
比如,你希望给你网站上所有页面和文章都使用叫 default 的布局。则添加以下代码:
defaults: - scope: path: "" # an empty string here means all files in the project type; “posts” values: layout: "default"The different types that are available to you are pages,posts,drafts or any collection in your site (自定义的 collection)
此外,defaults 可以包含多个 scope/values 对。
并且,你可以在具体的 post 或 page 文件里对这些设置重写。
5. _site 此目录下默认用来放置Jekyll生成的网站。最好把此文件夹添加到你的 .gitignore 文件里。运行下面代码。
~/Documents/project-directory$ touch .gitignore
6. 添加 images, fonts 或其他 CSS库
官网上在 structure 这一章节里讲到,除了列举出的默认的文件夹,项目根目录下的所有其他 directory 和 file(如 CSS 和 images 文件夹,favicon.ico 文件,等)都将逐一被直接复制到生成的网站下。所以,如果希望添加web font,如下:
@mixin embed-font($font-name, $font-filename) { @font-face { font-family: $font-name; src: url("../assets/fonts/" + $font-filename + ".ttf") format("truetype"); } } @include embed-font("cholla-slab", "ChollaSlabRegular"); $base-font-family: "cholla-slab", serif;
7. When to use a post, a page, or a collection
+-------------------------------------+ +----------------+ | Can the things be logically grouped?|---No--->| Use pages | +-------------------------------------+ +----------------+ | Yes | V +-------------------------------------+ +----------------+ | Are they grouped by date? |---No--->|Use a collection| +-------------------------------------+ +----------------+ | Yes | V +-------------------------------------+ | Use posts | +-------------------------------------+
相关文章推荐
- 芒果iOS开发之常见算法总结
- Hadoop五大守护进程的三种启动与关闭方式
- Linux:alias永久生效
- 传智播客:详解企业官网设计流程
- 一个简单的学生登陆系统的jsp实现之身份验证
- 《第一行代码——Android》之日志工具介绍
- 【转】用户权限设计——用户认证管理设计方案
- 关于Eclipse如何加入Gradle文件与Android Studio两个平台一起开发,工作目录不发生变化 转来的
- jQuery 如何设置input checkbox 更有效 prop()
- UITableViewCell 的Separator 间隔线
- oracle锁表
- 【参数】REMOTE_LOGIN_PASSWORDFILE参数三种取值及其行为特性分析
- CSS基础学习三:CSS语法
- Android 最简单的圆形头像
- 51.VC(Custom)-__super简介
- Linux下从svn导出项目
- 数学基础 求第k个数
- 爬取网页----获取自住房新闻
- ADO.NET provider with invariant name 'System.Data.SqlClient' could not be loaded
- 转载:测试用例