Login  Register

Overriding stylesdir value in per-file attributes

Posted by m52go on Oct 10, 2018; 2:52pm
URL: https://discuss.asciidoctor.org/Overriding-stylesdir-value-in-per-file-attributes-tp6508.html

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? Or is this how it's supposed to work?