code-surfer icon indicating copy to clipboard operation
code-surfer copied to clipboard

Choosing output path for build

Open roddds opened this issue 5 years ago • 3 comments

Right now, by running yarn build a static version of the presentation is generated in the /public directory, but I can't seem to figure out a way to change the relative path for static files. For example, if I'm uploading to a /presentation directory on my server, all static files 404 because index.html and other files have paths relative to the root.

In create-react-app this is solved by changing the path in the configuration file, but I can't seem to find how to do that with code-surfer.

roddds avatar Jan 21 '20 23:01 roddds

Upon further research, I realized Code Surfer is built on mdx-deck, which is built on gatsby, and according to https://github.com/gatsbyjs/gatsby/issues/1878 this will probably never be possible.

Damn.

roddds avatar Jan 21 '20 23:01 roddds

So it turns out I was barking at the wrong tree here - that gatsby issue is related to renaming the public directory itself, not any subdirectories. I also found this help page. So now the only step left was to figure out how to change mdx-deck's gatsby settings. As far as I could tell there was no way to do it directly, but as a workaround you could:

  • Change the ./node_modules/mdx-deck/gatsby-config.js and include the pathPrefix setting.
  • Change this in ./node_modules/.bin/mdx-deck from gatsby('build') to gatsby('build', '--prefix-paths').
  • Run your build

As far as workarounds go this is a pretty terrible one, but since I won't be running builds that often, this is acceptable to me.

Would love to hear from other people that had similar problems.

roddds avatar Jan 22 '20 00:01 roddds

Hi @roddds, I haven't tried changing the output path. But the build command is from mdx-deck not code-surfer. Maybe you should create the issue there.

pomber avatar Feb 13 '20 19:02 pomber