Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/caleorourke/grunt-jekyll-pages
Serve GitHub-flavored sites natively using Jekyll.
https://github.com/caleorourke/grunt-jekyll-pages
github-page grunt grunt-plugins javascript jekyll
Last synced: about 2 months ago
JSON representation
Serve GitHub-flavored sites natively using Jekyll.
- Host: GitHub
- URL: https://github.com/caleorourke/grunt-jekyll-pages
- Owner: caleorourke
- License: mit
- Created: 2014-08-24T02:23:35.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2018-03-23T13:05:04.000Z (almost 7 years ago)
- Last Synced: 2024-10-05T00:48:28.793Z (3 months ago)
- Topics: github-page, grunt, grunt-plugins, javascript, jekyll
- Language: JavaScript
- Homepage: http://caleorourke.github.io/grunt-jekyll-pages
- Size: 79.1 KB
- Stars: 2
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- Contributing: CONTRIBUTING.md
- License: MIT-LICENSE
Awesome Lists containing this project
README
# grunt-jekyll-pages
> Serve GitHub-flavored sites natively using Jekyll.[grunt-jekyll-pages](https://github.com/caleorourke/grunt-jekyll-pages) is for anyone working with GitHub Pages. This plugin emulates how Github Pages runs Jekyll in safe mode on Linux or Mac OS. It also provides a number of options (build, serve, watch, etc.) for dev and testing purposes.
The [npm package](https://www.npmjs.com/package/grunt-jekyll-pages) is available publicly.
## Getting Started
This plugin requires Node `>=0.10` and Grunt `>=0.4.0`.Jekyll and GitHub Pages ([pages-gem](https://github.com/github/pages-gem)) must also be installed. Refer to the [Jekyll Installation](https://jekyllrb.com/docs/installation) guide for instructions.
If you haven't used [Grunt](http://gruntjs.com) before, be sure to check out the [Getting Started](http://gruntjs.com/getting-started) guide. It explains how to create a [Gruntfile](http://gruntjs.com/sample-gruntfile), as well as how to install and use Grunt plugins. Once you are familiar with that, install this plugin with this command:
```shell
npm i grunt-jekyll-pages --save-dev
```Once the plugin has been installed, it may be enabled inside your Gruntfile with this line of JavaScript:
```js
grunt.loadNpmTasks('grunt-jekyll-pages');
```## Overview
Setup your `Gruntfile.js` to use any of the options below by adding a section named `pages` to the data object passed into `grunt.initConfig()`.```js
grunt.initConfig({
pages: {
options: {
// Task-specific options go here.
},
your_target: {
// Target-specific file lists and/or options go here.
},
},
});
```Use this method to add or append configuration options, targets, etc., to the `pages` task.
```js
grunt.initConfig({
pages: { // Task
options: { // Universal options
bundleExec: true,
src: '<%= app %>'
},
dist: { // Target
options: { // Target options
dest: '<%= dist %>',
config: '_config.yml,_config.build.yml'
}
},
serve: { // Another target
options: {
dest: '.jekyll',
drafts: true
}
}
}
});grunt.loadNpmTasks('grunt-jekyll-pages');
grunt.registerTask('default', ['pages']);
```## Options
You can use the [configuration options](https://github.com/caleorourke/grunt-jekyll-pages/blob/master/OPTIONS.md) available for this plugin. Refer to the [Jekyll Documentation](http://jekyllrb.com/docs/configuration) for additional options.## Usage Examples
Follow these Grunt examples to get started with grunt-jekyll-pages quickly.### Single Task
This example includes one registered task. `grunt verify` generates the site locally and makes it available at [10.0.0.1:8080](10.0.0.1:8080).```js
grunt.initConfig({
pages: {
preview: {
options: {
serve: true,
host: '10.0.0.1'
port: '8080'
}
}
}
});grunt.loadNpmTasks("grunt-jekyll-pages");
grunt.registerTask("verify", ["pages:preview"]);
```### Multiple Tasks
This example includes two registered tasks. `grunt serve` generates the site locally, watches for changes, and makes it available at [localhost:4000](localhost:4000). `grunt test` generates the site and displays on-screen warnings for symlink errors.```js
grunt.initConfig({
pages: {
test: {},
serve: {
options: {
watch: true,
serve: true,
baseurl: ['\"\"']
}
}
}
});grunt.loadNpmTasks('grunt-jekyll-pages');
grunt.registerTask('serve', ['pages:serve']);
grunt.registerTask('test', ['pages:test']);
```### No Tasks (Raw)
This example has no specific task defined. `grunt pages:a` builds Jekyll's `_config.yml` file with a set of specific options, while `grunt pages:b` builds the same file with different options.```js
grunt.initConfig({
pages: {
a: {
options: {
config: '_config.yml',
// Construct a string with JavaScript
// Remember line breaks and indentation matter in YAML
raw: 'highlighter: pygments\n' +
'exclude: [\'development\']\n' +
'author:\n' +
' name: ' + fetchAuthor() + '\n' +
' email: ' + fetchEmail()
}
}
b: {
options: {
config: '_config.yml',
// Construct a string with JavaScript
// Remember line breaks and indentation matter in YAML
raw: 'highlighter: rouge\n' +
'exclude: [\'production\']\n' +
'author:\n' +
' name: ' + fetchAuthor() + '\n' +
' email: ' + fetchEmail()
}
}
}
});grunt.loadNpmTasks('grunt-jekyll-pages');
```## Testing
Run the following command to test this plugin.```shell
$ grunt test-plugin
```## Contributing
Please read the [Contributing Guidelines](http://github.com/caleorourke/grunt-jekyll-pages/blob/master/CONTRIBUTING.md) before submitting code. In lieu of a formal styleguide, take care to maintain the existing coding style. Add tests for any new or changed functionality. Lint and test your code using [Grunt](http://gruntjs.com).## Release History
See the [Release History](http://github.com/caleorourke/grunt-jekyll-pages/blob/master/HISTORY.md) for enhancements and changes applied to each version.