Open ggrossetie opened 4 years ago
Now it won't. We should really have a nice templates feature on Asciidoctor instead of resorting to using options
.
Anyhow, you can workaround it by doing
asciidoctor {
inputs.file "${project.projectDir}/resources/templates"
}
Thanks for the workaround, I will give it a try.
I guess I should do the same for include files, docinfo and embed images right? input.file
takes a list of paths or can I call it multiple times?
asciidoctor {
inputs.file "${project.projectDir}/resources/templates"
inputs.file "${project.projectDir}/docs/**.html" // docinfo files
inputs.file "${project.projectDir}/resources/images/**" // embed images
}
inputs.files
is what you would need in that case OR you can call inputs.file
multiple times. Docinfo files should automatically be checked for changes.
And now I woke up. So docinfo
files are already (and correctly) covered if you use the html
or docbook
backends. This is done via the default setup for secondarySources
(items partaking in the document generation, but does not end up in the destination fodler). See https://github.com/asciidoctor/asciidoctor-gradle-plugin/blob/a4507c00eb50d2e807f89105acab788ebf97a002/asciidoctor-gradle-jvm/src/main/groovy/org/asciidoctor/gradle/jvm/AsciidoctorTask.groovy#L115 for the gory details.
Images are normally setup via
asciidoctor {
resources {
from 'resources'
include 'images/**'
}
}
If you did something like that changes in images should be automatically detected. If they are not, then it is a bug.
You can also pass your templates to secondarySources
instead of using inputs
, but if you are and intermediate working directory, it will be referencing the incorrect location. Probably not a big deal in your czse as everything will still work.
So docinfo files are already (and correctly) covered if you use the html or docbook backends.
I'm using docinfo with the reveal.js backend. I think that's the reason why it's not working. Should I open a pull request to implement the same logic in the reveal.js module ?
Now it won't. We should really have a nice templates feature on Asciidoctor instead of resorting to using options.
Can I open a pull request to introduce a dedicated attribute "templates"?
Should we automatically add templates to the input.files
?
I'm using docinfo with the reveal.js backend. I think that's the reason why it's not working. Should I open a pull request to implement the same logic in the reveal.js module ?
That makes sense as the Reveal task does not extend the AsciidoctorTask. I think if you want to do a PR to add the functionality to AsciidoctorJRevealJSTask
, then that would be great.
Can I open a pull request to introduce a dedicated attribute "templates"? Should we automatically add templates to the input.files?
I think you should rather just work around it for now, but also raise an isue for this functionality to be added. I want to give a bit of thought on how to implement it in a more gradlesque way (maybe similar to what was done for PDF themes).
@ysb33r I've just been caught out by included files not automatically being part of the task's inputs. This breaks up-to-date checks and, upon a clean build, results in a cache hit when it should have missed. Included files are mentioned above but the title suggest's the issue is focused on templates. Is this issue tracking addressing this or is a separate issue warranted?
I've been trying to figure out what's going on with the above. As far as I can tell, the secondary source file tree should cover the included files. That is indeed what happens in a standalone reproduction attempt, but not in my actual build.
@ysb33r Sorry for the noise. Please ignore this for now until I manage to reproduce it with a minimal project.
I'm not sure if I need to configure something explicitly (or not) but I've noticed that Gradle won't process AsciiDoc files again if a template changed.
I'm using the following configuration:
First run with a clean copy
Edit a template file
Run again
As you can see it took only 408ms because Gradle didn't process the AsciiDoc files.