When working with FSCSS, itβs useful to have your styles compiled automatically whenever you push changes. In this guide, weβll set up a workflow that:
β’ Compiles .fscss β .css automatically
β’ Commits the compiled CSS
β’ Deploys a demo page with GitHub Pages
The result is a simple CI/CD pipeline for your styles.
You can see the complete example repository here:
π https://github.com/fscss-ttr/clipfscss
Live demo:
π https://fscss-ttr.github.io/clipfscss/demo
- Project Structure
Hereβs the structure used in the example project.
repo/
β
βββ .github/workflows
β βββ compile.yml
β βββ pages.yml
β
βββ src/
β βββ style.fscss
β
βββ dist/
β βββ f.css
β
βββ demo/
β βββ index.html
β
βββ package.json
βββ package-lock.json
Explanation
- "src/" β FSCSS source files
- "dist/" β compiled CSS output
- "demo/" β static example page
- ".github/workflows/" β automation scripts
- Install FSCSS
Install via npm.
npm install -g fscss
Your package.json should look like this:
{
"dependencies": {
"fscss": "^1.1.17"
},
"scripts": {
"build:css": "fscss src/style.fscss dist/f.css"
}
}
Now you can compile locally:
npm run build:css
- Setup GitHub Action
Create:
.github/workflows/compile.yml
name: Compile FSCSS
on:
push:
paths:
- "**.fscss"
permissions:
contents: write
jobs:
build-css:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
with:
persist-credentials: true
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 22
- name: Install dependencies
run: npm install
- name: Compile FSCSS
run: npm run build:css
- name: Commit compiled CSS
run: |
git config user.name "github-actions"
git config user.email "github-actions@github.com"
git add dist/f.css
git commit -m "Auto compile FSCSS" || echo "No changes"
git push
What happens here?
push .fscss
β
GitHub Action runs
β
FSCSS compiles
β
dist/f.css updated
β
CSS committed automatically
- Deploy the Demo with GitHub Pages
Create another workflow:
.github/workflows/pages.yml
name: Deploy static site
on:
push:
branches: ["main"]
permissions:
contents: read
pages: write
id-token: write
jobs:
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/checkout@v4
- uses: actions/configure-pages@v5
- uses: actions/upload-pages-artifact@v3
with:
path: .
- id: deployment
uses: actions/deploy-pages@v4
Now every push will automatically update your GitHub Pages site.
- Using the CSS
Example HTML:
<link rel="stylesheet" href="../dist/f.css">
Your demo page will load the compiled CSS generated by the workflow.
Why This Setup Is Useful
This setup provides:
β automatic FSCSS compilation
β CI/CD integration
β clean project structure
β automatic demo deployment
Itβs a simple but powerful workflow for projects using FSCSS.
Full Example Repository
If you'd like to see everything working together, check out the example
Repository:
https://github.com/fscss-ttr/clipfscss
Top comments (0)