Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add importField in Hakyll.Web.Template.Context #927

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Zekt
Copy link

@Zekt Zekt commented Mar 16, 2022

As mentioned in #924 I've implemented a field for importing another file in the metadata.
Unfortunately, I haven't found the way to track the dependencies of the imported file (the usage of unsafeCompiler is probably non-ideal), which means rebuilds do not check if the imported files are modified.
Can anyone share some thoughts on how to track the dependencies?

@Minoru
Copy link
Collaborator

Minoru commented Mar 17, 2022

Thanks! To track dependencies, please use Hakyll.Core.Compiler.Internal.compilerTellDependencies.

@Zekt
Copy link
Author

Zekt commented Jun 6, 2022

Hi, @Minoru,
I've tried adding
compilerTellDependencies [IdentifierDependency (fromFilePath fp)]
before L472, where fp is the file path I have read from the import field, but it doesn't seems to track the files I imported (for example, a field import: config.yaml doesn't add config.yaml under the same directory to the dependencies), am I using it in a wrong way?

Also it seems the dependencies added are logged, could you tell me where to look for the compiler logs? Thanks!

@Minoru
Copy link
Collaborator

Minoru commented Jun 6, 2022

I believe all paths in Hakyll are relative to the providerDirectory. Try putting your config.yaml into the directory from which you run Hakyll, and see if it helps. Your compilerTellDependencies invocation looks fine to me, I think it should work.

In order to see logs, run Hakyll with --verbose. It will print them to the console.

@Zekt
Copy link
Author

Zekt commented Jun 10, 2022

By passing --verbose I can see my file is correctly added to the dependencies, but Hakyll doesn't recognize it as edited when checking for out-of-date items, putting the file in the root directory of my project doesn't differ much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants