This scope of this project is to explore the limits and the boundaries of by GSuite and Google Apps Script (GAS).
Everything started from the need to copy a paragraph style (line height, indentation, rulers, before and after paragraph spacing) to another paragraph.
It turns out that it is not so easy because GSuite do not expose any event handling facility. Just menus and dialog boxes or sidebar. There is no way to respond to a selection event even if in this case I tried a hack just to learn a bit more about security and CORS and see how Browsers behave.
To install this setup (that is good also for other GAS projects) you just have to clone this repository on your computer. Something like:
git clone https://github.com/endersaka/gas-copy-gdocs-paragraph-style.git name_of_the_new_destination_directory`
or
git clone [email protected]:endersaka/gas-copy-gdocs-paragraph-style.git name_of_the_new_destination_directory
Then you just need to install the Node.js modules.
npm install
Finally to build run:
npm run build
There are other three NPM scripts configured in package.json
.
-
upload
- to upload thedist
directory content to your GAS project on the server. -
deploy
- to build and upload in a single step. -
deploy:prod
- same asdeploy
but with Webpackmode
property set to'production'
.
If you get an error like the one described in this issue webpack-contrib/eslint-loader#306 you can find a temporary solution at the end of the issue report.
The first line of the error looks like:
ERROR in ./src/index.js
Module build failed (from ./node_modules/eslint-loader/dist/cjs.js):
TypeError: Cannot read property '0' of undefined