Jump to content

Some valid css, seem to be ignored or unvalidated by Squarespace

Recommended Posts

Posted

Hi,

I'd like to add some css, some kind of new (but totally valid) css to the custom css on my website :

max-height: 100svh;

but it turns my code into

max-height: 100s vh;

which is unvalid (see screenshot):

Screenshot2024-03-28at21_58_32.png.447ab194351aa7d823a44962c61bdaf2.png

 

Another totally valid css declaration that doesn't seem to work but should:

max-height: calc(100vh - var(--header-scrim-top-spacing));
// or
max-height: calc(100svh - var(--header-scrim-top-spacing));

You can definitely use variables into the calc function;

See mdn : https://developer.mozilla.org/en-US/docs/Web/CSS/calc

Screenshot2024-03-28at22_07_51.png.4a3530e328a06fa64cf8d48864a707ab.png

Screenshot2024-03-28at22_08_28.png.f9902e1db33b383b971a5c452d45cf7b.png

Not sure what happens exactly, but I would like my totally valid CSS being printed the exact same way I wrote it, without any form of validation or conversion or whatever.

 

Seriously what going on?

Screenshot2024-03-28at22_10_40.png.1f5a568819514782a2d8476519062694.png

and that how how it turns out on the front:

Screenshot2024-03-28at22_11_30.png.dbace8d8058d13506ef3aef5aba1d953.png

 

WTF?

 

Thank you.

 

  • Replies 5
  • Views 1.5k
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Posted Images

Posted

Here is the deal.

SS doesn't make it explicitly clear that Custom CSS supports LESS v1.3.1. Although if you dig around it becomes apparent. v1.3.1 is an ancient version of LESS and therefor you have to often use literals to get CSS syntax that came after v1.3.1 to work.

Examples

your-selector-here {

  max-height : ~"100svh";
  max-height : ~"calc( 100vh - var( --header-scrim-top-spacing ) )";
  max-height : ~"calc( 100svh - var( -- header-scrim-top-spacing ) )";
  
  }

Let us know how it goes.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

  • 3 weeks later...
Posted

I might be missing something... does Squarespace run LESS on my style.css template file after I sync it? I'm developing my template locally with a LESS build step that spits out a compressed style.css file that I then sync up with SS via git.

So I've got calc(~"100vh - 220px") in my style.less file that my local build compiles into calc(100vh - 220px) in style.css. But when I upload that style.css to SS, it becomes calc(-220vh) in my live site. WTF?

So I have to go in and manually add the ~"" back to my minified style.css file every time to get calc() to work with SS?

Is there a way for my local LESS to pass the string literals along to style.css? Googling for LESS info is so frustrating because "less" is a really common word in lots of contexts. Sigh...

Posted

I'm stewing about this... LESS v1.3 is 12 years old! Latest is v4. What on earth is keeping SS tied to this version? It's pretty maddening to write and upload valid CSS only to have it unnecessarily modified by the platform so it breaks my client's website. Upgrade LESS!

Posted
Quote

What on earth is keeping SS tied to this version?

Inertia, upgrading LESS isn't a flashy feature to sell to boards and investors, and etc.

Also as I understand it SS took LESS v1.3.3 and wrote their own Java version of the preprocessor to improve performance for mass market DIY website builder use. Doing that again given the above is a no go.

Find my contributions useful? Please like, upvote, mark my answer as the best ( solution ), and see my profile. Thanks for your support! I am a Squarespace ( and other technological things ) consultant open for new projects.

Posted

Fair enough. 

Here's the dumbest bit of code I've written in a long time in case anybody needs this specific thing. I downloaded replace-in-files-cli so I could make an npm package.json script to replace my calcs after compiling LESS locally. Here's the code:

"scripts": {
"squarespace-is-dumb": "replace-in-files --regex='calc\\(([^)]+)\\)' --replacement='calc(~\"$1\")' ./styles/style.css"
},

Create an account or sign in to comment

You need to be a member in order to leave a comment


×
×
  • Create New...

Squarespace Webinars

Free online sessions where you’ll learn the basics and refine your Squarespace skills.

Hire a Designer

Stand out online with the help of an experienced designer or developer.