Re: Overriding stylesdir value in per-file attributes
Posted by
mojavelinux on
Oct 10, 2018; 10:03pm
URL: https://discuss.asciidoctor.org/Overriding-stylesdir-value-in-per-file-attributes-tp6508p6509.html
If you want to be able to override an attribute in a document, you need to lower the precedence of the attribute assignment in the Gradle build file.
Cheers,
-Dan
On Wed, Oct 10, 2018 at 8:52 AM m52go [via Asciidoctor :: Discussion] <
[hidden email]> wrote:
Hello -- I'm trying to apply a custom CSS file to a set of docs with a couple of subdirectories. I'm using the Asciidoctor Gradle Plugin (v1.5.7) plugin to do the batch conversion.
I set the following in build.gradle:
attributes
'stylesheet' : 'custom.css',
'stylesdir' : './css'
This works great for all docs in the root directory, but all docs in subdirectories throw a "stylesheet does not exist or cannot be read" during the build process.
So, I tried overriding the build.gradle setting in each subdirectory doc with something like the following:
:stylesdir: ../css
OR
:stylesdir: ../../css
...depending on how nested the doc file is.
But these per-file values are ignored!
They only seem to be acknowledged when there is no value specified in build.gradle, i.e., the only way I can get these styles applied to all docs is to not specify stylesdir in build.gradle and instead specify it in every single doc file.
I really don't like doing that, both because it's a little sloppy and because these docs are for an open-source project which anyone can contribute to, and we'd really rather not have per-file dependencies/quirks like this.
Any idea what I can try to avoid this? I've tried getting rid of the css/ directory (putting the css file in the root directory), setting the stylesdir as an option instead of an attribute, setting the stylesheet and stylesdir together in subdirectory docs, and a bunch of other things...nothing works.
Per-doc settings are always ignored when they're set in build.gradle—both for docs in the root directory AND docs in subdirectories 
Any ideas what could be happening?
--