Automatically compile static project

Is there a way to set up a project to be static but have a compile step that runs when you make changes?

1 Like

Can you elaborate with an example? Do you mean like building files, where the outcome are static files?

Like a build command of sorts?

To speak for wh0… yeah. You may have heard of Static Site Generators like Jekyll or 11ty and their associated hosts like GH Pages and Netlify. They’re great.

I think this would be cool and I don’t think it’s possible right now. If you introduced a glitch.json file to a static site with a build action, I think it would disqualify the project from getting the Static Site platform. But I’m very happy for someone to experiment and prove me wrong :smiley:

YES!!! I’ve been wanting this feature since forever.

Shouldn’t this be a #feature-ideas?

1 Like

Just to clarify; you can run an SSG on Glitch today, it just won’t qualify as a Static Site :slight_smile:

1 Like

That’s actually the unfortunate part because static site generators are static sites.

I emailed this feature idea to Glitch once, and the Glitch engineers replied that “they were happy someone brought this idea up, because it was something they had been discussing lately”.

Here’s what they said:

As you pointed out, we do have a strict definition of static sites right now that doesn’t include anything that needs to be built or compiled first, and we make that determination based on files present. However, we are thinking about how to support projects that result in static sites after being built. It doesn’t share the same architecture for us on the backend so it wasn’t the first step we took when launching static sites, but it’s really useful to see that users like yourself are interested in it!

If such a feature is implemented, we might be able to run frameworks like React, Vue and Angular on Glitch as static sites.


+1 it seems there’s a lot of ways you could do this. You can do it on gh with post-commit hooks and stuff, it’s sad that we’d need a whole server all the time when what you really want is just output from a build… There must be a way, right?