Skip to content

Commands to start development env

Before you run any command, make sure you know whether the project uses Vite or Webpack. This affects how you build and deploy.

  • Open package.json

  • Look inside the scripts section:

    • If you see commands with vite → ✅ You’re using Vite

    • If you see webpack or a custom command like build:webpack → 🛠️ You’re using Webpack

🔗 See Before running for more info.

Webpack projects manage everything from package.json scripts, including building and deploying.

Terminal window
"scripts": {
"virtual": "webpack serve --config webpack.dev.js --open",
"local": "webpack --config webpack.prod.js",
"production": "webpack --config webpack.prod.js",
"dev-full": "gulp deploy_full",
"stg-hash": "gulp deploy_hash",
"prd-file": "gulp deploy_file --file"
}

→ Starts a live dev server (local preview) npm run virtual

→ Builds the project and creates dist npm run local or npm run production

→ Full deployment to development npm run dev-full

→ Deploy hash build to staging npm run stg-hash

→ Upload a single file to production npm run prd-file

📝 These are pre-configured shortcuts that run the correct Gulp tasks for each environment.

In your package.json, you’ll find these scripts:

Terminal window
"scripts": {
"virtual": "cross-env NODE_ENV=virtual vite",
"local": "NODE_ENV=local vite build",
"build": "NODE_ENV=production vite build"
}

Starts the project in a special “virtual” environment. Useful for development and testing with real data or mock content.

Builds the project using local settings. It prepares the output files but does not upload or preview anything.

🔗 Want to understand the difference? See virtual vs local environments for more info. Virtual vs Local

Builds the project with production settings. It creates a folder called dist and adds a short code (hash) of three characters to the filenames, like main.ab2.js.

🔁 After this, you must update the hash file and deploy it using the correct Gulp command below.

All the following commands use this format:

Terminal window
gulp <task> --dev|stage|production

You must always choose where you want to deploy:

--dev = development

--stage = staging

--production = live production

Uploads everything inside the dist folder.

🔸 gulp ddisthash —dev|stage|production
Section titled “🔸 gulp ddisthash —dev|stage|production”

Uploads the dist folder and the hash folder (which includes the version info). 👉 This is what you normally run after npm run build.

Deploy all flexible modules (custom reusable blocks).

Deploy all files (PHP, JS, assets, modules…).

Deploy only the PHP files.

🔸 gulp ds —dev|stage|production —path file|folder
Section titled “🔸 gulp ds —dev|stage|production —path file|folder”

Deploy just one file or one folder.

🔸 gulp remove —dev|stage|production —path file|folder
Section titled “🔸 gulp remove —dev|stage|production —path file|folder”

Deletes a file or folder from the server.

Switches your Node.js version to the one your project needs. Important if you’re switching between different projects or machines. Example:

nvm use 21

To check the version use node -v

Sometimes npm gives errors. This command clears the cache.

Follow these steps every time you want to work on the project and deploy your changes:

    1. 🔍 Check if the project uses Vite or Webpack
    1. 🧱 Make sure you’re using the right Node version
    1. 🛠️ Start the Project
    1. 🧾 Update the hash file
    1. 🚀 Upload your changes