[pmwiki-devel] PUB dir and javascript

Petko Yotov 5ko at 5ko.fr
Sun Mar 22 22:52:38 PDT 2020


On 23/03/2020 03:58, Simon wrote:
> If I am a recipe writer
> 
>    - skin (recipes) go in the /pub/skins directory

This can be either the "core" pmwiki/pub/skins directory where the skin 
can be used in all fields, or the "field" directory field/pub/skins 
where the skin only applies to the current field, and overrides any skin 
with the same name that could exist in pmwiki/pub/skins.

>    - recipe css (I guess) goes in the /pub/css directory

Not exactly, this directory, BTW always field/pub/css (*) contains CSS 
files that are automatically included by PmWiki, that normally could 
override core CSS and skin CSS (unless the skin does something 
specific). These are local.css and various Group.css or Group.Page.css.

It is not recommended for recipe authors to place individual files 
there, but many recipes have instructions to place custom code inside 
local.css (which is fine).

(*) "field" is the directory where index.php is (it includes pmwiki.php 
wherever the latter is) and in the simplest installation -- 
not-a-wiki-farm -- it is the one that exists in the core distribution.

>    - recipes go in the cookbook directory

PHP recipes, yes.

>    - recipe javascript goes ... ?
>    - recipe resources (e.g. graphics) go in /pub/*myrecipe*/
> Or as a recipe writer do I create a folder /pub/*myrecipe*/ and put
> everything in there?

If your recipe includes both CSS and JavaScript (most do) and possibly 
graphics, their place is in pub/your-recipe -- either the one under 
pmwiki ($FarmPubDirUrl/your-recipe), or the one under field 
($PubDirUrl/your-recipe).

> I'm a sort of a tidy developer and like to have a place for things, and 
> I
> can see that more and more recipes will be using javascript, hence the
> suggestion

Yes, recipes that only ship JavaScript and no CSS could use a suggestion 
to place their files in pmwiki/pub/js or in field/pub/js.

> As far as moving forward, should it be considered being worth doing 
> then
> yes, the old file becomes orphaned, but perhaps instructions to 
> manually
> delete it would be sufficient

Perhaps.

Petko

> On Sun, 22 Mar 2020 at 23:20, Petko Yotov <5ko at 5ko.fr> wrote:
> 
>> LocalTimes is not in the core, if it gets included then its logic will
>> go into pmwiki-utils.js.
>> 
>> I'll think about it -- one problem is that moving the file into a
>> subdirectory in the core will not move it on existing installations 
>> and
>> people will end with 2 versions of pmwiki-utils.js. Isn't this worse
>> than what happens now?
>> 
>> As the directories where the PmWiki core is installed should not be
>> writable by the PHP process, an automatic cleanup cannot be reliably
>> implemented.
>> 
>> Petko
>> 
>> On 21/03/2020 05:53, Simon wrote:
>> > I'd like to suggest that a new default sub-directory of the Pub dir be
>> > added for java script, as there is for CSS and Skins.
>> >
>> > I see for example localtimes.js and pm-utils.js in the pub dir root



More information about the pmwiki-devel mailing list