Grow your CSS skills. Land your dream job.

Compile PHP Site into static HTML

  • # August 19, 2014 at 4:00 am

    Hi!
    I have a personal site built in PHP. The PHP itself isn’t advanced, it’s nothing else than lots of include()/require() to simplify the structure of the site for myself. (ex. header.php, footer.php, nav.php, javascript.php, googleanalytics.php and many more, making up a total of 13 php files)
    Is there any way I can easily compile all this into static HTML through some sort of build process, a bit like SASS does with the @imports of SCSS when compiling to CSS? I have no experience with node.js nor grunt, but I wouldn’t mind to get some.

    The reason I want to do this is to minimize server response time.
    (I am using a PC)

    Best Regards,
    Wilhelm

    # August 19, 2014 at 6:42 am

    If you have handful of pages, load the site in your browser, visit each page and save it.

    If you have lots of pages, I’m sure there is some kind of build tool you could use. I haven’t really needed one so can’t help you there. Maybe someone else can chime in.

    # August 19, 2014 at 11:46 am

    I think what you’ll probably want is a static site generator.

    Jekyll is (probably) the most popular: http://jekyllrb.com/

    For another solution that includes Grunt, et al, I found this walkthrough to be particularly well done: http://davidtucker.net/articles/move-to-static-site-generator/ (1 of 3)

    Getting this stuff up and running opens up so many new worlds and you’ll level up your workflow like never before.

    # August 21, 2014 at 2:24 pm

    Thanks for all the replies! The problem with those are that they require templating languages and configuration files, much more than I need.
    I found this article, which helped me get the final result that I wanted :)

    Best regards,
    Wilhelm

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".