Custom template in css extension is searched among CSS config dir instead of my extension config dir #1901
Replies: 2 comments 1 reply
-
Your HTML templates not being found is a consequence of how Node.js handles file paths. If you have a relative file path, such as CommunitySolidServer/src/util/PathUtil.ts Lines 309 to 311 in f59b2c2 Since you can't use that prefix you should probably change your I recently had the idea actually to allow new components to register their own prefix so the same utilities can be reused #1883. |
Beta Was this translation helpful? Give feedback.
-
I am also creating an extension package and ran into the same issue. In my case, I created a subclass of the ejs template engine and used the override function in components.js to replace the CSS instances. Please refer to the TypeScript class and configuration file below. |
Beta Was this translation helpful? Give feedback.
-
As the title states, I am writing an extension to store data of the CSS on OneDrive (each Pod has its OneDrive account linked).
I am pretty much done at it, but I still have one problem:
<npm package dir>/config/....
, while they are, since the package is installed via npm, in<npm package dir>/node-modules/<extension-name>/config/...
.The following are the steps I used to make it work (from the extension dir):
In the above way everything works fine, since templates are actually stoerd in the
config
dir on the package root directory. But I cannot ship my extension via repo so I would like to make an installable package.In order to do this I've done the following:
In this way, despite componentsjs works and all my extension's classes are up and running, the said html templates are not found since being searched in a supposed
config
dir in the root of the client package.I had the same oucome also by installing both packages globally, then running css via npx.
It might be good to say also that my extension is not yet published to any registry, and the installation is done via filepath for now to it's package root (
npm install [-g] ./extension/myextension
), as I would like to do while developing it.The following is how I reference the file from within the extension config for the view handler:
This is the package.json of the extension I am writing:
Beta Was this translation helpful? Give feedback.
All reactions