Skin layer and valid file extensions

Hi.

I I defined a skin layer as documented here: https://docs.plone.org/adapt-and-extend/theming/templates_css/skin_layers.html#defining-a-skin-layer

But it seems that only a few file types are available in portal_skins like *.js, *.ico, *.png, but I also need *.ttf and *.woff and maybe more. How can I enable these file types too?

I am using Plone 5.2 with Python 3.6.

Please use https://docs.plone.org/external/plone.app.dexterity/docs/advanced/static-resources.html instead

With static resources the path to the files are example.com/++plone++my.package.name/bla.ttf or similar. But I want them to be available directly on the root path.

Skins layer is gone (or at least deprecated) in Plone 5.2 - don't use them anymore

The skin layer is still used in many other packages and it works great so far. Also the documentation does not say anything about a deprecated skin layer.
How should I know about that if it is not documented anywhere?

What I need is the possibility to make a bunch of files publicly available on the root path of Plone just by installing my extension and without uploading files manually using Zope's managing interface.

This was announced multiple times lately on the Plone conference(s). Not sure if portal_skins is still around and working in Plone 5.2...but anyway...forget portal_skins, it will not be there in next major version. And it's obsolete since many years. No modern code writing over the last years uses portal_skins anymore.

What's the new method then? How can I make files available in the root directory?

By reading the thread carefully: first comment by Roel

You should read carefully. I already mentioned that this does not work for me. :wink:
Or at least I can not find any documentation about how to register any type of file side-wide. I don't know how the cssregistry or jsregistry should help me with other files.

I want to replace the whole site root with an Angular app which needs different resources available at the site root. It should be manageable as easy as possible because our Angular developer does not know anything about Plone. He just pushes all the necessary files into one directory in our egg and I need to make them accessible through Plone.

Either create content items or dtml files in the root.
Or use nginx's http://nginx.org/en/docs/http/ngx_http_core_module.html#try_files . Upload all angular related stuff to the vhost's https://docs.nginx.com/nginx/admin-guide/web-server/serving-static-content/#root and you don't need to get Plone involved in serving it at all.

I don't see why resources must be placed in the root. Any JS framework is capable of using and fetching from arbitrary paths. You know your options.

1 Like

I can not use nginx because the loadbalancer runs on Apache on an other server which has no access to the files inside Plone. It just proxies Plone.

So then I have to speak to our Angular developer if he can create the App in a way that it loads its dependencies from a ++plone++my.package.name/ sub directory instead from the root itself. We want to make our package available through an egg proxy to our customer. After installing the extension it should just run without changing anything on the Apache.

Just add '.dtml' suffix to your files in skins folder to make them work. If your file is "font.ttf" name it as "font.ttf.dtml"

I already tried that and unfortunately it did not work. Therefore I asked you guys for help.

I am just curious - even if it is deprecated and we are now looking for a way using the static directory - but is there a possibility to make other file types available through the skins folder without using the DTML parser?

Not that I am aware of.

In the past we have made font files accessible in skins folder using the '.dtml' trick, so it should work.

I'm using nginx as an example here. Apache can probably do the same.
Yes, angular should be able to do that.

Adding '.dtml' should work: http://demo.plone.org/compare.css comes from Products.CMFEditions-3.3.2-py3.7.egg/Products/CMFEditions/skins/CMFEditions/compare.css.dtml via portal_skins/CMFEditions.
I see not reason why font.ttf.dtml would not work.

Maybe I or my co-worker did something wrong then. He remembered doing this with the .dtml extension in the past and tried it out but he said it did not work. Maybe it's because it is deprecated and not even implemented in Plone 5.2 using Python 3.6? I don't know.
Nevertheless I think the better idea then is to actually use modern mechanisms and avoid deprecated stuff. Right?

yes

Another idea (if you want to keep your resources on the filesystem but use them from within Plone: look at xmldirector.connector that allows you to "mount" a filesystem path into the Plone and its traversal (not solving the "must be in root" requirement).

Just an idea:
If he (just) does not want to see the images in Plone:
Could it be possible to add files or images as 'Zope objects' from the ZMI (or maybe from setuphandlers.py or similar)?

Plone Foundation Code of Conduct