To run a specific script in Webflow using npm, you’ll actually need to manage custom scripts outside of Webflow’s native environment, typically via a local development setup (e.g., to build assets or process data), then integrate the result into Webflow using custom code embeds or uploaded files.
Here’s how to do it step-by-step.
mkdir my-webflow-helper and cd my-webflow-helper.npm init -y to create a package.json file.npm install sass if you're compiling SCSS.
package.json, under the "scripts" section, add a custom script.
Example:
"build:sass": "sass src/styles.scss dist/styles.css"src/styles.scss, dist/, etc.).
npm run build:sass
You cannot upload or execute npm-built projects directly in Webflow, but:
<link> or <script> in Webflow's custom code blocks.
npm run ...).
You can’t run npm scripts directly in Webflow, but you can run them locally to build or compile assets, and then manually include the output in Webflow using Custom Code embeds or uploaded assets. The workflow involves external tooling with npm and manual integration into Webflow’s code areas.