saichon2namoom/gas icon
public
Published on 5/20/2025
google app script rule

Rules

๐Ÿ“˜ Google Apps Script Web App Guidelines ๐Ÿšง Build & Development Commands Use clasp for local development and deployment: clasp clone <script-id> โ€“ Clone existing Apps Script project clasp push โ€“ Push local changes to cloud clasp pull โ€“ Sync cloud changes to local clasp open โ€“ Open project in Google Apps Script editor clasp deploy โ€“ Create or update Web App deployment Tip: Store clasp.json securely and add it to .gitignore if it contains sensitive info. โœ… Web App Development Guidelines Use doGet() to serve HTML pages: function doGet() { return HtmlService.createHtmlOutputFromFile('index'); } Create HTML files in your project (e.g., index.html). To include partial HTML components (e.g., header.html):

<?!= include('header'); ?> function include(filename) { return HtmlService.createHtmlOutputFromFile(filename).getContent(); }

๐Ÿงช Testing Guidelines Test Web App via deployment: Deploy โ†’ "Web App" โ†’ Set access to "Anyone" for testing Use console.log() in client JavaScript Use Logger.log() in server-side Code.gs Use browser developer tools to inspect UI behavior ๐ŸŽจ Code Style & Guidelines Suggested file structure: Code.gs โ€“ Entry point and server functions index.html โ€“ Main UI file /html/includes/ โ€“ HTML partials /js/ and /css/ โ€“ Optional folders for assets Style recommendations: Use modern JavaScript (let, const, arrow functions) Use camelCase naming End all lines with semicolons Add JSDoc-style comments to functions ๐Ÿ“š Documentation Guidelines README.md should include: Project overview Features Setup steps (clasp login, clone, push) Deployment instructions File structure explanation Developer notes In-code comments: Use JSDoc for all public/shared functions Note any limitations or workarounds used ๐Ÿ”’ Security & Permissions Use only required scopes in appsscript.json Do not hardcode sensitive data Use PropertiesService or OAuth for storing secrets Set appropriate access levels for Web App deployments ๐Ÿงช Optional Enhancements Integrate TypeScript Add eslint/prettier for formatting Use GitHub Actions to automate clasp push Consider gas-webpack for larger apps