slate icon indicating copy to clipboard operation
slate copied to clipboard

Slate Docker image v2.11.0 does not seem to use SassC, very slow CSS render.

Open flojdek opened this issue 4 years ago • 5 comments

Bug Description I'm running the vanilla v2.11.0 from the Docker repo and it's not using SassC to compile the css and it is extremely slow.

$ docker run --rm --name slate -p 4567:4567 -v $(pwd)/src:/srv/slate/source slatedocs/slate:v2.11.0 serve == The Middleman is loading == Sprockets will render css with ruby sass consider using Sprockets 4.x to render with SassC

Screenshots

image

Is this by design or is this a bug?

flojdek avatar Oct 11 '21 04:10 flojdek

While using sassc would be ideal, it is not API compatible with the sass gem and that migration does not seem to be simple (see #1368 for some details). I'm not a user knowledgable Ruby developer, so happy to accept a PR on this, but not something I would be implementing, especially in favor of furthering work on slate v3 where we move to a JS based solution.

MasterOdin avatar Oct 11 '21 06:10 MasterOdin

Hey @MasterOdin thanks a lot for quick reply. Understood. Any idea how to speed up the css loads with the current version? Apart from obvious caching on the edge servers.

flojdek avatar Oct 11 '21 06:10 flojdek

The intention is that you would only use serve for development purposes, and use build for production given that slate is intended to be a static site.

If you really needed to use serve for some reason, I'd recommend probably compiling down the sass stylesheets into css separately, and then link to those built css files in the erb template when you do serve, avoiding the sass compilation step (assuming you're not doing some level of dynamism there).

MasterOdin avatar Oct 11 '21 07:10 MasterOdin

Sorry, what do you mean by build in PROD? Where is this documented? I only ever found examples with serve and I was specifically looking for some documentation how to properly run this thing in PROD in Docker. Can you point me to relevant documentation or just drop few lines here? That would be very much appreciated.

Yeah, I've actually tried that, but failed so far, seems the scss files always pop back in. Need to spend some more time on this one.

flojdek avatar Oct 11 '21 08:10 flojdek

See https://github.com/slatedocs/slate/wiki/Using-Slate-in-Docker#building-slate for building Slate with Docker.

After running it, you will see the built artifacts in that build directory that was mounted into the container. I've updated the article to hopefully make that clearer.

MasterOdin avatar Oct 11 '21 08:10 MasterOdin