grunt-jekyll
Advanced tools
Comparing version 0.1.6 to 0.2.0
{ | ||
"name": "grunt-jekyll", | ||
"description": "A custom grunt.js plugin that executes jekyll compile and/or watch for you", | ||
"version": "0.1.6", | ||
"version": "0.2.0", | ||
"homepage": "https://github.com/dannyx0/grunt-jekyll", | ||
@@ -6,0 +6,0 @@ "author": { |
234
README.md
@@ -1,8 +0,5 @@ | ||
grunt-jekyll | ||
============ | ||
# grunt-jekyll | ||
Simple grunt Jekyll task. The code base is inspred by [grunt-compass](https://github.com/kahlil/grunt-compass). | ||
Straightforward grunt.js Jekyll plugin. The code base is inspred by [grunt-compass](https://github.com/kahlil/grunt-compass). This means its use is similar but outlined in detail here. | ||
This means its use is similar but is outlined in detail here. | ||
## Dependencies | ||
@@ -14,130 +11,124 @@ | ||
Follow [this grunt.js example](https://gist.github.com/3753650) to get started with grunt-jekyll right away! | ||
Follow [this grunt.js example](https://gist.github.com/3753650) to get started with grunt-jekyll right away. | ||
## Installation & Options | ||
All the configuration options are on the [Jekyll Wiki](https://github.com/mojombo/jekyll/wiki/configuration). | ||
### Installation | ||
1. Install this grunt plugin next to your project's grunt.js gruntfile with: `npm install grunt-jekyll`. | ||
2. Call `grunt.loadNpmTasks('grunt-jekyll')` in your gruntfile. | ||
3. Configure `grunt jekyll` to watch your html files and call the task(s). | ||
e.g.: | ||
Install this grunt plugin next to your project's grunt.js gruntfile with: | ||
npm install grunt-jekyll | ||
```javascript | ||
watch: { | ||
files: ['templates/*.html'], | ||
tasks: ['jekyll:dev', 'jekyll:prod'] | ||
} | ||
``` | ||
### Configuration Options | ||
4. Setup your HTML paths | ||
All the configuration options are | ||
```javascript | ||
src: 'templates/', | ||
dest: 'dist/' | ||
``` | ||
* on the [Jekyll Wiki](https://github.com/mojombo/jekyll/wiki/configuration). | ||
* optional | ||
* explained here within the `grunt.js` task object context: | ||
`src` is the folder with your html templates and `dest` is the folder where the compiled files will be placed. | ||
<table> | ||
<tr> | ||
<th>Object Property</th> | ||
<th>Type</th> | ||
<th>Default Value</th> | ||
<th>Notes</th> | ||
</tr> | ||
<tr> | ||
<td><pre>src</pre></td> | ||
<td><pre>[path]</pre></td> | ||
<td><pre>"."</pre></td> | ||
<td>Source Path</td> | ||
</tr> | ||
<tr> | ||
<td><pre>dest</pre></td> | ||
<td><pre>[path]</pre></td> | ||
<td><pre>"."</pre></td> | ||
<td>Destination Path</td> | ||
</tr> | ||
<tr> | ||
<td><pre>safe</pre></td> | ||
<td><pre>[bool]</pre></td> | ||
<td><pre>false</pre></td> | ||
<td>Disables custom plugins.</td> | ||
</tr> | ||
<tr> | ||
<td><pre>auto</pre></td> | ||
<td><pre>[bool]</pre></td> | ||
<td><pre>false</pre></td> | ||
<td>Jekyll watches src path for changes.</td> | ||
</tr> | ||
<tr> | ||
<td><pre>server</pre></td> | ||
<td><pre>[bool]</pre></td> | ||
<td><pre>false</pre></td> | ||
<td>Jekyll Server</td> | ||
</tr> | ||
<tr> | ||
<td><pre>server_port</pre></td> | ||
<td><pre>[int]</pre></td> | ||
<td><pre>undefined</pre></td> | ||
<td>Server Port</td> | ||
</tr> | ||
<tr> | ||
<td><pre>baseurl</pre></td> | ||
<td><pre>[url]</pre></td> | ||
<td><pre>undefined</pre></td> | ||
<td>Serve from URL</td> | ||
</tr> | ||
<tr> | ||
<td><pre>url</pre></td> | ||
<td><pre>[url]</pre></td> | ||
<td><pre>undefined</pre></td> | ||
<td>Sets site.url</td> | ||
</tr> | ||
<tr> | ||
<td><pre>markdown</pre></td> | ||
<td><pre>[engine]</pre></td> | ||
<td><pre>undefined</pre></td> | ||
<td>Markdown Engine</td> | ||
</tr> | ||
<tr> | ||
<td><pre>pygments</pre></td> | ||
<td><pre>[bool]</pre></td> | ||
<td><pre>false</pre></td> | ||
<td>Syntax Highlighting</td> | ||
</tr> | ||
<tr> | ||
<td><pre>future</pre></td> | ||
<td><pre>[bool]</pre></td> | ||
<td><pre>false</pre></td> | ||
<td>Publish Future Posts</td> | ||
</tr> | ||
<tr> | ||
<td><pre>lsi</pre></td> | ||
<td><pre>[bool]</pre></td> | ||
<td><pre>false</pre></td> | ||
<td>Related Posts Index</td> | ||
</tr> | ||
<tr> | ||
<td><pre>permalink</pre></td> | ||
<td><pre>[style]</pre></td> | ||
<td><pre>undefined</pre></td> | ||
<td>Permalink Style</td> | ||
</tr> | ||
<tr> | ||
<td><pre>paginate</pre></td> | ||
<td><pre>[int]</pre></td> | ||
<td><pre>undefined</pre></td> | ||
<td>Per-page Pagination</td> | ||
</tr> | ||
<tr> | ||
<td><pre>limit_posts</pre></td> | ||
<td><pre>[int]</pre></td> | ||
<td><pre>undefined</pre></td> | ||
<td>Max Posts</td> | ||
</tr> | ||
</table> | ||
5. Disable custom plugins like this: | ||
```javascript | ||
safe: 'false' | ||
``` | ||
6. Watch for file chnages like this: | ||
## Changelog | ||
```javascript | ||
auto: true | ||
``` | ||
7. Start the Jekyll server: | ||
v0.2.0: Updated README with better options. Options are more flexible. | ||
```javascript | ||
server: true | ||
``` | ||
8. Set the server port: | ||
```javascript | ||
server_port: 8000 | ||
``` | ||
9. Server website from a given url: | ||
```javascript | ||
baseurl: 'http://example.com' | ||
``` | ||
10. Sets site.url, useful for environment switching: | ||
```javascript | ||
url: 'http://other-url.com' | ||
``` | ||
11. Customize engine type | ||
```javascript | ||
markdown: 'maruku' | ||
``` | ||
12. Enables highlight tag with Pygments: | ||
```javascript | ||
pygments: true | ||
``` | ||
13. Publishes posts with a future date: | ||
```javascript | ||
future: true | ||
``` | ||
14. Produces an index for related posts: | ||
```javascript | ||
lsi: true | ||
``` | ||
15. Controls the URLs that posts are generated with: | ||
```javascript | ||
permalink: 'pretty' | ||
``` | ||
16. Per-page pagination value: | ||
```javascript | ||
paginate: 10 | ||
``` | ||
17. Limits the number of posts to parse and publish: | ||
```javascript | ||
limit_posts: 30 | ||
``` | ||
18. Run "grunt watch" and make cool stuff! | ||
# An Example Setup | ||
```javascript | ||
jekyll: { | ||
dev: { | ||
src : 'templates/', | ||
dest : 'dev/', | ||
server_port : 3333, | ||
future : true, | ||
permalink : 'pretty', | ||
paginate : 20 | ||
}, | ||
prod: { | ||
src : 'templates/', | ||
dest : 'prod/', | ||
server_port : 8000, | ||
permalink : 'pretty', | ||
paginate : 10 | ||
} | ||
} | ||
``` | ||
# Changelog | ||
v0.1.6: Updated README with better example. | ||
@@ -147,3 +138,2 @@ | ||
---- | ||
@@ -150,0 +140,0 @@ ## MIT License |
@@ -11,94 +11,99 @@ module.exports = function (grunt) { | ||
src, | ||
dest, | ||
// User input options. | ||
opt = { | ||
src : this.data.src, | ||
dest : this.data.dest, | ||
bundleExec : this.data.bundleExec, | ||
safe : this.data.safe, | ||
auto : this.data.auto, | ||
server : this.data.server, | ||
server_port : this.data.server_port, | ||
baseurl : this.data.baseurl, | ||
url : this.data.url, | ||
markdown : this.data.markdown, | ||
pygments : this.data.pygments, | ||
future : this.data.future, | ||
lsi : this.data.lsi, | ||
permalink : this.data.permalink, | ||
paginate : this.data.paginate, | ||
limit_posts : this.data.limit_posts | ||
}; | ||
// Defaults | ||
safe = this.data.safe, | ||
auto = this.data.auto, | ||
server = this.data.server, | ||
server_port = this.data.server_port, | ||
baseurl = this.data.baseurl, | ||
url = this.data.url, | ||
markdown = this.data.markdown, | ||
pygments = this.data.pygments, | ||
future = this.data.future, | ||
lsi = this.data.lsi, | ||
permalink = this.data.permalink, | ||
paginate = this.data.paginate, | ||
limit_posts = this.data.limit_posts; | ||
// Set settings. | ||
if (typeof this.data.src !== 'undefined') { | ||
src = grunt.template.process(this.data.src); | ||
if (opt.src) { | ||
opt.src = grunt.template.process(this.data.src); | ||
} else { | ||
src = '.'; | ||
opt.src = '.'; | ||
} | ||
if (typeof this.data.dest !== 'undefined') { | ||
dest = grunt.template.process(this.data.dest); | ||
if (opt.src) { | ||
opt.dest = grunt.template.process(this.data.dest); | ||
} else { | ||
src = '.'; | ||
opt.src = '.'; | ||
} | ||
if (typeof bundleExec !== 'undefined') { | ||
if (opt.bundleExec) { | ||
command = 'bundle exec ' + command; | ||
} | ||
if (typeof src !== 'undefined' && typeof dest !== 'undefined') { | ||
if (opt.src && opt.dest) { | ||
command += ' "' + src + '" "' + dest + '"'; | ||
} | ||
if (typeof safe !== 'undefined') { | ||
if (opt.safe) { | ||
command += ' --safe'; | ||
} | ||
if (typeof auto !== 'undefined') { | ||
if (opt.auto) { | ||
command += ' --auto'; | ||
} else { | ||
command += ' --no-auto'; | ||
} | ||
if (typeof server !== 'undefined') { | ||
if (opt.server) { | ||
command += ' --server'; | ||
if (typeof server_port !== 'undefined') { | ||
command += ' ' + server_port; | ||
if (opt.server_port) { | ||
command += ' ' + opt.server_port; | ||
} | ||
} else if (typeof server_port !== 'undefined') { | ||
command += ' --server ' + server_port; | ||
} else if (opt.server_port) { | ||
command += ' --server ' + opt.server_port; | ||
} | ||
if (typeof baseurl !== 'undefined') { | ||
command += ' --base-url ' + baseurl; | ||
if (opt.baseurl) { | ||
command += ' --base-url ' + opt.baseurl; | ||
} | ||
if (typeof url !== 'undefined') { | ||
command += ' --url ' + url; | ||
if (opt.url) { | ||
command += ' --url ' + opt.url; | ||
} | ||
if (typeof markdown !== 'undefined') { | ||
command += ' --' + markdown; | ||
if (opt.markdown) { | ||
command += ' --' + opt.markdown; | ||
} | ||
if (typeof pygments !== 'undefined') { | ||
if (opt.pygments) { | ||
command += ' --pygments'; | ||
} | ||
if (typeof future !== 'undefined') { | ||
if (opt.future) { | ||
command += ' --future'; | ||
} else { | ||
command += ' --no-future'; | ||
} | ||
if (typeof lsi !== 'undefined') { | ||
if (opt.lsi) { | ||
command += ' --lsi'; | ||
} | ||
if (typeof permalink !== 'undefined') { | ||
command += ' --permalink=' + permalink; | ||
if (opt.permalink) { | ||
command += ' --permalink=' + opt.permalink; | ||
} | ||
if (typeof paginate !== 'undefined') { | ||
command += ' --paginate ' + paginate; | ||
if (opt.paginate) { | ||
command += ' --paginate ' + opt.paginate; | ||
} | ||
if (typeof limit_posts !== 'undefined') { | ||
command += ' --limit_posts=' + limit_posts; | ||
if (opt.limit_posts) { | ||
command += ' --limit_posts=' + opt.limit_posts; | ||
} | ||
@@ -108,3 +113,3 @@ | ||
grunt.log.write('\n\njekyll output:\n'); | ||
grunt.log.write('\n\nJekyll output:\n'); | ||
grunt.log.write(stdout); | ||
@@ -115,4 +120,3 @@ | ||
done(false); | ||
} | ||
else { | ||
} else { | ||
done(true); | ||
@@ -119,0 +123,0 @@ } |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7571
101
151