Coder Social home page Coder Social logo

basil2style / google-sheet-addon-svelte-starter Goto Github PK

View Code? Open in Web Editor NEW
5.0 2.0 3.0 65 KB

A Google Sheet addon template using Svelte 3 + Vite

HTML 74.61% Svelte 5.18% CSS 4.91% TypeScript 14.45% JavaScript 0.85%
google-sheets-addon svelte vite

google-sheet-addon-svelte-starter's Introduction

google-sheet-addon-svelte-starter

A template repository to develop a Google Sheet add-on with Svelte + Vite.

Demo screenshot

image

google-sheet-addon-template

Getting Started

  1. Clone the repository and install npm dependencies. Please note that there are two projects that you need to install npm packages(one for the sidebar and the other one for the clasp).

    git clone https://github.com/basil2style/google-sheet-addon-svelte-starter my-project
    cd my-project
    npm install
    
  2. Log in and authenticate with your Google account:

    
    npm run clasp:login
    
    

    You can also use npx for running clasp locally

  3. Create a new Sheet project:

    
    npm run clasp:create
    
    

    Make sure that you've .clasp.json and appsscript.json files on the root folder before deploying.

    image

  4. Deploy the project:

    
    npm run deploy
    
    
  5. Open the project:

    
    npm run clasp:open
    
    

    The sidebar/dist directory contains the bundled svelte code. We will copy the index.html from the dist folder to /src using the build:post script.

.claspignore

This is similar to .gitignore. You can use this to include only the necessary files.

Test the add-on on Google Sheet

Once you followed the steps above and have the Apps Script project open, the following steps explain how to test the add-on:

  1. Click Extensions, then Select our Addon...
  2. Select Open to run the HTML file.

This opens the Svelte sidebar.

Sidebar development

Navigate to the sidebar folder and develop & test the application as you would any regular Svelte application, i.e. npm run dev.

Another addon template HTML development

Settings page will open as a modal dialog in Google Sheet rather than sidebar ui. To update, you need to uncomment defineConfig.build.rollupOptions.input.settings line & comment out the defineConfig.build.rollupOptions.input.main. Because, the output build is not working in Google Sheet when combine both inputs files.

Files to note:

  • sidebar/src/settings.ts
  • sidebar/src/settings.html
  • sidebar/vite.config.ts
  • loadSettingsUI() in src/index.ts

CSS Framework

I added Pico CSS framework for this project, but you can change it to your framework

Routing

References

google-sheet-addon-svelte-starter's People

Contributors

basil2style avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

fhyltavz jeo1kim

google-sheet-addon-svelte-starter's Issues

Routing

Any thoughts how to best handle the routing for multi-page setups?

currently i'm containing it all in a single page with a reactive element that switches out components acting as pages but hit errors with svelte trying to destroy child elements that no longer exist when switching to another page.

~nice repo btw, good base

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.