'Can you build an Excel task pane add-in with Svelte?
Solution 1:[1]
Well... let's break it down
Is it possible?
Short answer: yes
Long answer: the documentation clearly states that Excel add-in
still uses jQuery
for logic manipulations. If your question was about Angular
or react
it would probably be a hard NO since those frameworks use an engine that should be included as part of solution. This kind of dependencies when dealing with plugins development are pretty hard to implement and maintain as a function of time so it's better to use very lightweight, non-core dependencies instead. Since you are asking about svelte
- it is "compiled" into a bundle
that contains pure code (based on your app logic). So - as long as your app rely on the load event sequence described in the docs - you are good to go.
Do you really need Webpack?
Short answer: no
Long answer: svelte can be deployed using rollup
instead - which is more suitable for micro-applications (such as yours). So, if you feel that webpack (somehow) is blocking your work pipeline - just use svelete
default configuration with rollup
and you are ready to go
Your workflow
Create a very simple
svelte
app (my suggestion - try to take the example in the docs and implement it usingsvelte
)Test it locally (just verify it works)
Build it (you should ended up with 3 files - 1
html
file inpublic
directory and 2 other files inpublic/build
directory - 1js
file and 1css file
(both calledbundle
)Here's the tricky part - the
html
file does nothing - just loading thecss
andjs
files. In your case - you don't really need itChange the
bundle.css
file toHome.css
fileChange the
bundle.js
file toHome.js
file and put your app inside the add-in main function'use strict'; (function () { Office.onReady(function() { // Office is ready YOUR SVELTE APP CODE SHOULD BE PLACED HERE }); })();
Pack your add-in and test it
Technical notes
- If Excel blocks the creation of new elements (using dynamic injection) - this approach will NOT work (since your entire app is generated by your
js
file) - Please refer to this article for more information about packing your app
- Try to make your app as lightweight and small-size as possible just to avoid the risk of exceeding the limits allowed for add-ins
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | ymz |