Skip to content

Commit 1e1c6d5

Browse files
committed
Accepts configurable script type and template language.
1 parent 4d2a92c commit 1e1c6d5

File tree

2 files changed

+24
-8
lines changed

2 files changed

+24
-8
lines changed

README.MD

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,19 @@ Or, do manual install:
1313
`"riot-brunch": "git+https://github.com/yavorsky/riot-brunch.git"`.
1414

1515

16+
## Configuration
17+
18+
19+
```
20+
plugins:
21+
on: ["riot"]
22+
riot:
23+
extension: 'tag' # pattern overrides extension
24+
pattern: /\.tag$/ # default
25+
template: 'jade'
26+
type: 'coffeescript'
27+
```
28+
1629
## License
1730

1831
The MIT License (MIT)

index.js

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ var compile = require('riot').compile;
22

33
RiotCompiler = function(config) {
44
this.config = (config && config.plugins && config.plugins.riot) || {};
5-
console.log("compiling riot======");
5+
console.log("compiling riot with ======");
66
// The extension or pattern logic makes for some logic mess
77
// We prefer, in this order, an explicit pattern, an explicit
88
// extention, or a default extension
@@ -12,22 +12,25 @@ RiotCompiler = function(config) {
1212
this.extension = this.config.extension;
1313
} else {
1414
this.pattern = /\.tag$/;
15-
this.pattern = /\.riot$/;
1615
}
17-
16+
this.compiler_options = {};
17+
// this.compiler_options.template = 'jade';
18+
if (this.config.template) {
19+
this.compiler_options.template = this.config.template;
20+
}
21+
this.compiler_options.type = this.config.type;
22+
console.dir(this.config);
23+
console.dir(this.compiler_options);
1824
}
1925

2026
RiotCompiler.prototype.brunchPlugin = true;
2127
RiotCompiler.prototype.type = 'javascript';
2228

2329
RiotCompiler.prototype.compile = function(data, path, callback) {
24-
console.log("compiling " + path);
30+
console.log("compiling-->" + path + "\n");
2531
var compiled;
2632
try {
27-
compiled = compile(data, {
28-
template: "jade",
29-
type: "coffeescript"
30-
});
33+
compiled = compile(data, this.compiler_options);
3134
} catch (err) {
3235
var loc = err.location,
3336
error;

0 commit comments

Comments
 (0)