equanimitus
equanimitus

Reputation: 1

Hakyll isn't picking up my JavaScript file during compilation

I'm trying to set up a blog using Hakyll, and I've been running into some issues with adding JavaScript files. I'm trying to follow the standard way of handling JavaScript files with Hakyll, but my .js files don't seem to be getting picked up by the compiler.

Here is the relevant part of my site.hs file:

main :: IO ()
main = hakyll $ do
    match "images/*" $ do
        route   idRoute
        compile copyFileCompiler

    match "js/*" $ do
        route   idRoute
        compile copyFileCompiler

...

My JavaScript file (script.js) is located in the js directory at the root level of my project. The file is not empty.

When I run my Hakyll site, the JavaScript file isn't copied into the _site directory as expected. I've tried using different matching patterns, like "js/script.js" and "**.js", but none of them seem to work.

I've also made sure that the tag in my HTML file is correctly referencing the JavaScript file:

<script src="/js/script.js"></script>

Running ls -l js/script.js shows that the file exists:

-rw-r--r--@ 1 dan  staff  35  2 Jul 23:10 js/script.js

I've tried cleaning and rebuilding the site multiple times, but the JavaScript file is never included in the _site directory. All other files (like images and CSS) are handled correctly.

I'm not sure what I'm doing wrong here. Any help would be greatly appreciated!

Upvotes: 0

Views: 94

Answers (0)

Related Questions