victor-hugo icon indicating copy to clipboard operation
victor-hugo copied to clipboard

npm start doesn't work correctly with themes

Open alexpov opened this issue 6 years ago • 5 comments

When trying to use victor-hugo with themes, and running the npm start script as stated in the guide. Getting a site with broken CSS.

Tried to use the starta theme based on this tutorial: A Step-by-Step Guide: Victor-Hugo on Netlify and the tranquilpeak theme.

The npm run build command works well. When the site is deployed to netlify, all is good. The issue is only in the local dev environment.

When setting the baseURL from / to https://mydomain.com the issue seems to be resolved, however, all links are relative to https://mydomain.com thus each click opens the deployed version and not the localhost version

As a workaround, using hugo server -D command from the site folder

Hugo version: 0.5.4

alexpov avatar Mar 09 '19 07:03 alexpov

Same issue here. I've had luck with using npm run preview instead of npm start during local development.

tomanistor avatar May 18 '19 06:05 tomanistor

If someone can dig in and get a fix together I'm happy to review and merge.

erquhart avatar May 29 '19 19:05 erquhart

I receive a bunch of "function hugo not defined when running npm start or npm run preview when using a theme

ERROR 2019/05/30 00:26:18 Failed to add template "404.html" in path "404.html": template: 404.html:49: function "hugo" not defined ERROR 2019/05/30 00:26:18 Failed to add template "_default/list.html" in path "_default/list.html": template: _default/list.html:49: function "hugo" not defined ERROR 2019/05/30 00:26:18 Failed to add template "_default/single.html" in path "_default/single.html": template: _default/single.html:49: function "hugo" not defined ERROR 2019/05/30 00:26:18 Failed to add template "index.html" in path "index.html": template: index.html:49: function "hugo" not defined

aguywithcode avatar May 30 '19 05:05 aguywithcode

I'm also seeing a bunch of Failed to add template... function "hugo" not defined" as well while trying to use a theme. Same with npm run preview

using hugo server -D command from the site folder works

sugaroverflow avatar Jul 04 '19 22:07 sugaroverflow

Any update on this? Having the same problem using themes, it looks like webpack is somehow running the non-extended version of hugo (thus not building the themes sass), but I have extended installed via Homebrew and running hugo server/build works fine.

aaronkwhite-sh avatar Mar 09 '20 14:03 aaronkwhite-sh