Skip to content

tidurand/webflow-dev-template

Repository files navigation

Webflow Dev Template

A template for starting all your Webflow projects requiring code using Typescript. It looks like the one of finsweet but it's easily customizable and the deployement is easier.

Requirements

Install pnpm on your computer

npm i -g pnpm

Got a npm access token : How to do

Installation

  1. Click on Use this template > Create a repository
  2. Change some settings in your repository

Settings > Secrets and variables > Actions > New repository secret

  • Name: NPM_TOKEN
  • Secret: you token from npm
  1. Install dependencies
pnpm install

You can start your project! Here are two useful scripts:

Dev mode (with live reload)

pnpm dev

Build (for production)

pnpm build
  1. Write your code in src/index.ts (don't touch Webflow.push but you should remove console.log)
Webflow.push(() => {
  //Write your code here

  console.log('Hello World')
})

Deployment

Commit all your work

Then write :

pnpm release

Choose between Major, Minor or Patch and write a commit message for the deployment

Push your code,

When CI/CD is finished in Github, your package will appear in npm.

Tools

The advantage of this template is you can easily change each tool to suit your configuration.

Finsweet ts-utils (don't change)

Finsweet did a HUGE work by typing the Webflow.js file included in all Webflow projects.

With this, you can access many types and methods not provided by Webflow.

ts-utils documentation

ESBuild

A fast JavaScript bundler and minifier that compiles and packages JavaScript and TypeScript code for deployment.

Update builder/esbuild.js

It includes a live reload in builder/live-reload.js

TSConfig

A configuration file for TypeScript that specifies the compiler options and file paths required to compile a TypeScript project.

Update tsconfig.json

ESLint

A static code analysis tool for JavaScript that identifies and fixes problems in your code to ensure adherence to specified coding standards and best practices.

Update eslint.config.js

Prettier

A code formatter for JavaScript that enforces consistent style by parsing code and reprinting it with its own rules.

Update .prettierrc file.

Husky (Git hooks)

A tool that enables Git hook scripts to run automatically, helping to enforce quality checks and other tasks during the development process.

Add hooks in .husky folder

bump-version.js (versioning)

A script for managing and automating versioning.

Update builder/bump-version.js

CI/CD

This pipeline uses GitHub Actions

Release

Publish package to npm

Update .github/workflows.realease.yml

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published