kitajchuk / node-squarespace-server

DEPRECATED! A local Squarespace development server in node.js.
MIT License
186 stars 26 forks source link

Stylesheets are being loaded 2 times #157

Closed patbegg closed 8 years ago

patbegg commented 8 years ago

Hi, Great work on this bad boy, helps development A LOT.

Im seeing an issue that I don't know is related to Squarespace or the the node-squarespace-server package. I can see the 2 stylesheets being loaded: 'site.css?&filterFeatures=false' and 'site.css'. The problem is BOTH contain my custom CSS i've created. It loads the former from 'http://static1.squarespace.com/static/sitecss/' and the later locally (though i can't even see where this file is as it's not in my project so i'm assuming it's cached). This means that if I changecss locally it still grabs the old styles from Squarespace (from 'site.css?&filterFeatures=false').

I'm using {squarespace-headers} in the .

Can you replicate this?

Thanks, Pat

kitajchuk commented 8 years ago

This is a known issue for the local server. There is no way to replicate the remote CSS you get from Squarespace that is NOT your own template CSS - so the server loads local on top of remote. It's been a pain point for the project since day one. As of now, no good resolve has ever come to light.

This issue was the last great attempt at finding a solution - but it also hit a dead end: https://github.com/NodeSquarespace/node-squarespace-server/issues/123.

I know its not ideal, but its an issue I've just learned to work with for now as a developer on Squarespace sites. For me, its actually not too big of an issue until I take a site live - then it sucks for sure.

patbegg commented 8 years ago

Hi, Thanks for the clarification (apologies for the late response, just back on the project).

Can I ask what you do when developing locally then? Do you remove {squarespace-headers} and add back in when you're pushing the site live?

kitajchuk commented 8 years ago

I just push to master and bust local cache whenever I need to clear out old styles muffling up my new local modifications. I'll note that this is really only a solid solution while still in development. Once a site goes live, this isn't the best answer. At this point I've done everything under the sun but its just a delicate game you play. I do have some thoughts on it in terms of more formalized resolutions.

One possible solution would be to remove all of your template specific CSS. Then push that up to master and get a fresh pull with the node server. This would give you site.css from Squarespace with only Squarespace CSS in it. Copy that and put it in a local file that can be loaded. This would then allow the node server to look for a specific local file and if it exists it could actually remove the remote reference to site.css in rendering and load the CSS all locally, something like this in pseudo:

<link href="/site.local.remote.css" />
<link href="/site.local.css" />

I know this is a bit of a hassle, but it could be pretty easy if I just dump the Squarespace CSS in a gist and have instructions in the README on how to setup the local file. Modifying the node server to account for this file and perform the above condition would not be difficult at all.

Mayhaps I'll play around with this... :)