Install and Configure Sculpin in the ServBay Environment
What is Sculpin?
Sculpin is a PHP-based static site generator, suitable for creating blogs, documentation, and other static websites. It uses the Twig templating engine and YAML front matter, making website development very flexible and powerful.
Steps to Install Sculpin
In this article, we will introduce how to install and configure Sculpin in the ServBay environment.
Step 1: Create the Project Directory
First, create a new project directory in ServBay's www
directory:
cd /Applications/ServBay/www
mkdir servbay-sculpin-app
cd servbay-sculpin-app
2
3
Step 2: Create a Sculpin Project Using Composer
ServBay already includes Composer, so we can use Composer directly to create a Sculpin project:
composer create-project sculpin/sculpin-blog-skeleton .
Step 3: Configure the Web Server
Add a New Website
Open ServBay, click the "Hosts" tab, and add a new website:
- Name:
My Sculpin Site
- Domain:
servbay-sculpin.local
- Site Type:
PHP
- PHP Version: Select the appropriate PHP version
- Site Root Directory:
/Applications/ServBay/www/servbay-sculpin-app/output_dev
- Name:
Save Configuration
Save the configuration and restart ServBay.
Step 4: Build the Sculpin Site
Install Dependencies
In the project directory, run the following command to install the dependencies:
bashcomposer install
1Build the Site
Run the following command to build the Sculpin site:
bashvendor/bin/sculpin generate --watch --server
1
Step 5: Run the Local Development Server
Start the Local Development Server
Run the following command to start the local development server:
bashvendor/bin/sculpin generate --server --watch
1Access the Development Server
Open a browser and visit
https://servbay-sculpin.local
, you will see the local development version of the Sculpin site.
Step 6: Customize the Sculpin Site
Edit Content
Edit Markdown files and Twig template files in the
source
directory to customize your site's content and layout.Add New Pages
Create new Markdown files in the
source
directory to add new pages. For example, create anabout.md
file:markdown--- title: "About Us" --- # About Us This is the about page.
1
2
3
4
5
6
7Configure Navigation Menu
Edit the Twig template files for the navigation menu in the
source/_layouts
directory to add new navigation links.Rebuild the Site
Every time you modify content or templates, run the following command to rebuild the Sculpin site:
bashvendor/bin/sculpin generate
1
Building a Site with Sculpin
Now that you have successfully installed and configured Sculpin in the ServBay environment, you can start using it to build your site. Here are some common operations:
Create Blog Posts
Create a Post
Create a new Markdown file in the
source/_posts
directory to add a blog post. For example, create a2024-06-06-my-first-post.md
file:markdown--- title: "My First Post" date: 2024-06-06 --- # My First Post This is the content of my first post.
1
2
3
4
5
6
7
8Rebuild the Site
Run the following command to build the Sculpin site:
bashvendor/bin/sculpin generate
1
Customize Styles and Scripts
Edit Styles
Edit the CSS files in the
source/assets/css
directory to customize the style of your site.Edit Scripts
Edit the JavaScript files in the
source/assets/js
directory to customize the interactive behavior of your site.Compile Assets
Run the following command to compile CSS and JavaScript files:
bashvendor/bin/sculpin generate
1
By following these steps, you have successfully installed and configured Sculpin in the ServBay environment and started using it to build your site. Sculpin's flexibility and powerful features make it an ideal choice for building static websites.