CMS Development

LambertStrategy
Contributor

HubL Local Server not Rendering CSS and Javascript

SOLVE

Can anyone show me what needs to be done to get the JS, CSS, and images working properly on the local HubSpot server? The site has been built out locally using HubL's Local Server environment, and I'm firing it up with terminal on osx. 

 

When I open the file directly in Chrome it loads the JS and CSS perfectly, but when I view the same page in http://127.0.0.1:8080/custom/page/example.html It does not render either the javascript, css, or images. 

 

I have tried adding the minimum required HubL snippets ( header and footer) with no effect. 

 

 

 

 

0 Upvotes
1 Accepted solution
LambertStrategy
Solution
Contributor

HubL Local Server not Rendering CSS and Javascript

SOLVE

My solution to getting CSS, JS, and images to work in my local development with hubspot's local involved the following:

 

1. Adding HubL to the head

{{ standard_header_includes }}
<link rel="stylesheet" href="{{ get_public_template_url('example.css') }}">

2. Adding "/file_manager/" to the beginning of all image paths. Unfortunately, this is not in the documentation from Hubspot about using the Hubspot Local server. It should be. The post I found it on is here: StackOverflow

View solution in original post

0 Upvotes
3 Replies 3
Gonzalo
Top Contributor | Diamond Partner
Top Contributor | Diamond Partner

HubL Local Server not Rendering CSS and Javascript

SOLVE

Hey @LambertStrategy,

 

Did you changed anything in the conf/config.yaml ? Usually it just works fine since the start.

Seems like or you have something wrongly configurated or the 8080 port is already taken by other process.

 

I never had such kind of error so if didn't changed the config try first changing the port and admin port to a different one (in the mentioned config file) if none of that work or you have already tweaked your config probably you have setup wrongly the contextBaseDir, templateBaseDir or the extensionResourceMappings. So double check the paths and try removing **bleep** symbols in the names (if exists).

 

 

If this answer helps you to solve your questions please mark it as a solution.

Thank you,


Gonzalo Torreras

HubSpot freelance developer

hola@gonzalotorreras.com
www.gonzalotorreras.com
Schedule a meeting
LambertStrategy
Contributor

HubL Local Server not Rendering CSS and Javascript

SOLVE

Hi Gonzalo, 

 

Thanks for your advice. I looked at the config.yaml, which had not been edited, and sought to make changes but no luck. After re-installing the Hubl local server, I think I've found the problem. I'm getting 404s on all the GET requests. I have a feeling that has to do with the yaml file but I don't know what to do.

 

-  Lambert Strategy

0 Upvotes
LambertStrategy
Solution
Contributor

HubL Local Server not Rendering CSS and Javascript

SOLVE

My solution to getting CSS, JS, and images to work in my local development with hubspot's local involved the following:

 

1. Adding HubL to the head

{{ standard_header_includes }}
<link rel="stylesheet" href="{{ get_public_template_url('example.css') }}">

2. Adding "/file_manager/" to the beginning of all image paths. Unfortunately, this is not in the documentation from Hubspot about using the Hubspot Local server. It should be. The post I found it on is here: StackOverflow

0 Upvotes