Git Product home page Git Product logo

vite-webflow-starter-glsl's Introduction

This is a repo showing my workflow for custom code Webflow using Vite

I recommend using Codesandbox (you could also just have it hosted locally while in development).

To get started

  1. Clone this repo.
  2. Go to Codesandbox and import the cloned repo.
  3. Codesandbox will prompt you to install the dependencies during the environment setup and start the server in development mode.
  4. Go to your Webflow project and add the following code to the head of your project:
<script type="module" src="http://localhost:3000/@vite/client"></script> This is to see your changes in real time.
<script type="module" src="http://localhost:3000/js/index.js"></script>
  1. Replace http://localhost:3000 with the URL of your Codesandbox project.
  2. Make sure to edit the code in the canvas.js file to match your Webflow elements.
  3. Save and publish your Webflow project.
  4. You should now see your changes in real time.

I used Curtainsjs for the WebGL example. You can use whatever library you choose.

Because codesandbox servers don't run forever, you will need to build your project for production by running yarn build and host the generated index.js file someplace.

Places to host your index.js file

  • You can upload the file to your Webflow project and link to it. You have to convert the file to a .txt file before uploading and then link to it. This is because Webflow doesn't allow you to upload .js files. You should replace the head code with the link yto the file as shown below:

    <script
    type="text/javascript"
    src="https://uploads-ssl.webflow.com/${hash}/index.js.txt"
    ></script>
  • Push the file to Github and paste the Github link on jsDelivr. It will give you a link to use in your Webflow project. Note that the file will be cached for 7 days. To update the file, you will need to purge the cache - https://www.jsdelivr.com/tools/purge.

  • Look into alternative CDN options like unpkg, Cloudflare, etc.

vite-webflow-starter-glsl's People

Contributors

oluwadareseyi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.