-
Notifications
You must be signed in to change notification settings - Fork 505
Use metadata to inject the experiment.html when "experiment": true #73
Conversation
a810eae
to
3f49b20
Compare
@sebastianbenz fixed the two questions I asked. PTAL |
@@ -60,6 +60,15 @@ module.exports = function(templateRoot, template) { | |||
const example = ExampleFile.fromPath(file.path); | |||
const nextExample = example.nextFile(); | |||
|
|||
// Experimet must be injected in the first section only |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: typo in Experiment
3f49b20
to
ea73000
Compare
@@ -13,9 +13,12 @@ | |||
<body> | |||
<div class="body"> | |||
{{> header.html}} | |||
{{#sections}} | |||
{{#data.sections}} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why do we need the additional 'data' indirection?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In order to pass:
"experimental": function() {
return (idx++ == 0 && document.metadata.experiment);
Experimental needs to be inside the first section.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@juliantoledo understood, but couldn't we just add the function as a field in the args object?
1a265d6
to
b2a7f57
Compare
I have a commit based on this branch that passes this experimental flag to validation task and skips validation for experimental examples. I can wait for this PR to land in master or add the commit here. I just wanted to be sure this PR satisfied requirements for that. |
@jkingyens Sounds good, the metadata is already supported in the document parser. I will finish this PR in a bit. |
b2a7f57
to
4d919d4
Compare
@sebastianbenz fixed your comments and added the metadata instructions to the readme. |
4d919d4
to
f692c31
Compare
}; | ||
|
||
if (document.metadata.experiment && (!document.metadata.component || | ||
document.metadata.component.length === 0)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (document.metadata.experiment && !document.metadata.component)
is enough:
> false == ''
true
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
f692c31
to
42d0b1f
Compare
}; | ||
|
||
if (document.metadata.experiment && (!document.metadata.component || | ||
document.metadata.component.length === 0)) { | ||
throw new Error("Example (" + example.url() + |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
throw a gulp exception: throw new PluginError(plugin: 'compile-example', message: '...');
42d0b1f
to
c1032c8
Compare
c1032c8
to
1d08d0b
Compare
LGTM - good work! |
Use metadata to inject the experiment.html when "experiment": true
No description provided.