DEV Community

Discussion on: One thing led to another and I built my own static site generator today

Collapse
 
dtinth profile image
Thai Pangsakulyanont • Edited

I agree about keeping dependencies low in small projects! When I hop between multiple projects, I can feel the context switching cost if there are setups involved.

By the way, this looks like a great use-case for…

<html lang="en">
  <head>
    <?php include 'workspace/meta.partial.html'; ?>
    <style>
      <?php include 'workspace/style.partial.css'; ?>
    </style>
  </head>
  <body>
    <?php include 'workspace/body.partial.html'; ?>
    <script>
      // Data
      var data = <?php include 'workspace/data.json'; ?>;

      // Code
      <?php include 'workspace/scaffold.partial.js'; ?>;
      <?php include 'workspace/dynamic.partial.js'; ?>;
    </script>
    <?php include 'workspace/analytics.partial.html'; ?>
    <?php if (isset($_GET['test'])) include 'workspace/test.dev.html'; ?>
  </body>
</html>
# Launch a development web server
$ php -S 0.0.0.0:1234

# View production build
$ open http://localhost:1234

# View test build
$ open http://localhost:1234/?test

# Build static site
$ php index.php > index.html
Collapse
 
sirseanofloxley profile image
Sean Allin Newell

Blasphemy! Beautiful blasphemy!

Collapse
 
dtinth profile image
Thai Pangsakulyanont
Collapse
 
ben profile image
Ben Halpern

I haven’t used PHP in years... and this seems very appealing!

Collapse
 
thanasismpalatsoukas profile image
Sakis bal

What stack do you primarily use? Thanks for your response beforehand.