Skip to content

Commit de2d195

Browse files
committed
Set theme jekyll-theme-cayman and migrate Page Generator content
1 parent 5ecc03a commit de2d195

File tree

2 files changed

+88
-0
lines changed

2 files changed

+88
-0
lines changed

_config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
title: pegjs-loader
2+
description: PEG.js loader for webpack
3+
google_analytics: UA-39470592-2
4+
show_downloads: true
5+
theme: jekyll-theme-cayman
6+
7+
gems:
8+
- jekyll-mentions

index.md

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
# [PEG.js](https://github.com/pegjs/pegjs) loader for [webpack](http://webpack.github.io/)
2+
3+
[![build status](https://img.shields.io/travis/eploko/pegjs-loader/master.svg?style=flat-square)](https://travis-ci.org/eploko/pegjs-loader)
4+
[![npm version](https://img.shields.io/npm/v/pegjs-loader.svg?style=flat-square)](https://www.npmjs.com/package/pegjs-loader)
5+
[![npm downloads](https://img.shields.io/npm/dm/pegjs-loader.svg?style=flat-square)](https://www.npmjs.com/package/pegjs-loader)
6+
7+
## Install
8+
9+
`npm install --save-dev pegjs-loader pegjs webpack`
10+
11+
The pegjs-loader requires [PEG.js](https://github.com/pegjs/pegjs) and [webpack](https://github.com/webpack/webpack)
12+
as [`peerDependency`](https://docs.npmjs.com/files/package.json#peerdependencies). Thus you are able to specify the required versions accurately.
13+
14+
## Usage
15+
16+
[Documentation: Using loaders](http://webpack.github.io/docs/using-loaders.html)
17+
18+
``` js
19+
var parser = require("!pegjs!./parser.pegjs");
20+
// => returns compiled PEG.js parser
21+
```
22+
23+
### Apply via webpack config
24+
25+
It's recommended to adjust your `webpack.config` so `pegjs!` is applied automatically on all files ending with `.pegjs`:
26+
27+
``` js
28+
module.exports = {
29+
...
30+
module: {
31+
loaders: [
32+
{
33+
test: /\.pegjs$/,
34+
loader: 'pegjs-loader'
35+
}
36+
]
37+
}
38+
};
39+
```
40+
41+
Then you only need to write: `require("./parser.pegjs")`.
42+
43+
### PEG.js options
44+
45+
You can pass options to PEG.js as [query parameters](http://webpack.github.io/docs/using-loaders.html#query-parameters). The following options are supported:
46+
47+
* `cache` — if `true`, makes the parser cache results, avoiding exponential
48+
parsing time in pathological cases but making the parser slower (default:
49+
`false`)
50+
51+
* `optimize` - whether to optimize the built parser either for `speed` or
52+
`size` (default: `speed`)
53+
54+
``` js
55+
module.exports = {
56+
...
57+
module: {
58+
loaders: [
59+
{
60+
test: /\.pegjs$/,
61+
loader: 'pegjs-loader?cache=true&optimize=size'
62+
}
63+
]
64+
}
65+
};
66+
```
67+
68+
## Change Log
69+
70+
This project adheres to [Semantic Versioning](http://semver.org/).
71+
Every release, along with the migration instructions, if any, is documented on the Github [Releases](https://github.com/eploko/pegjs-loader/releases) page.
72+
73+
## Thanks
74+
75+
* [Victor Homyakov](https://github.com/victor-homyakov) for the propagation of the `cache` option.
76+
* [VladimirTechMan](https://github.com/VladimirTechMan) for the propagation of the `optimize` option.
77+
78+
## License
79+
80+
MIT (http://www.opensource.org/licenses/mit-license.php)

0 commit comments

Comments
 (0)