You can use clones. For example:
--@settings
----my-shared-settings
------...
----some-specific-settings-for-this-outline
------....

--@file my-shared-settings-somewhere.txt
----my-shared-settings

where `my-shared-settings` node is cloned from the @file subtree.

Quite often I use some script to combine some nodes, process them and 
generate some output file. And such script I put in a node with the 
following headline: `@button n-save @key=Ctrl-s`. Then whenever I open this 
outline and whenever I hit Ctrl-s to save the outline, this script is 
executed. Of course I put in this script `c.save()` call and on every save 
my files are regenerated. 

When working for a web I often use Coffeescript, some html template 
generators like Pug, Sass for generating css files, ... Now all of these 
command line tools have watching mode where they watch folders for file 
changes and whenever source file is changed they regenerate the output 
file. But then you also need to run some packaging tool to bundle all 
generated files. Instead of watching for file changes, my script bound to 
Ctrl-s regenerate source files in memory and without saving them execute 
suitable tool only on changed sources and produced outputs bundle in the 
final file. This makes the whole process much faster.

Attached to this message is a Leo file that I have extracted from one of my 
projects. I hope that I didn't miss anything that the script require. 

In the outline you can find build server implemented in Coffeescript. You 
have to use npm or yarn to install necessary modules for this server to 
work. Once installed you start server by executing `coffee 
tools/build-server.coffee and it will start listening on port 8011. The 
script bound to Ctrl-s will search outline for nodes with the headlines 
like: @vendor, @pug, @coffee, @bulma and for each found node, it checks if 
the content of this node and its subtree has changed since last time and if 
it is, this content is sent to build server which transforms the source and 
returns result that script writes to output file. 

There is one more thing I use for sharing outlines. There are three 
commands `set-reference-file`, `update-ref-file` and `read-ref-file`. The 
first lets you choose a reference file for this outline, i.e. public shared 
outline. It adds a top level headline `---begin-private-area---` to the 
outline. In the body of this node is the path to the public Leo file. 
Everything below this node is private, and above is public. The public file 
should be added to version control (git, fossil,...) and the private file 
should be added to ignored files for version control tool. And then in the 
script bound to Ctrl-s you can add `c.fileCommands.save_ref()`, so every 
time you save your private Leo file, at the same time is updated the public 
Leo file. That way they never get out of sync.

HTH Vitalije

On Friday, July 19, 2019 at 10:16:28 PM UTC+2, gar wrote:
>
> And how it is possible to specify setings in @file? As I understand 
> every setting should be a single outline 
>
> 2019-07-19 22:36 GMT+03:00, Chris George <[email protected] <javascript:>>: 
>
> > I can think of several approaches. 
> > 
> > @outline-data tree-abbreviations in myLeoSettings.leo that is available 
> to 
> > all Leo files. 
> > @button 
> > @command 
> > Point all files to an @file node and share the settings via a single 
> text 
> > file. ie. conf.py or a YAML file 
> > 
> > There may be reasons some of these approaches wouldn't work for your 
> case. 
> > But some might. 
> > 
> > HTH, 
> > 
> > Chris 
> > 
> > On Friday, July 19, 2019 at 11:09:33 AM UTC-7, gar wrote: 
> >> 
> >> Imagine you develop several tied software projects at the moment. 
> >> Imagine they all use the same settings (like basic paths, colors, 
> whatever 
> >> 
> >> else). 
> >> 
> >> In before-leo world you probably have several template files which you 
> >> fill with current values and include into your projects and reuse 
> settings 
> >> 
> >> in there 
> >> (file.cfg.in -> file.cfg idiom, where file.cfg.in is under source 
> control 
> >> 
> >> and file.cfg is ignored) 
> >> And how to deal with this in leo? 
> >> AFAIK it's impossible to include other .leo projects or their parts. 
> >> 
> >> How to implement settings/code reuse? 
> >> Put everything into myLeoSettings.leo? 
> >> 
> > 
> > -- 
> > You received this message because you are subscribed to the Google 
> Groups 
> > "leo-editor" group. 
> > To unsubscribe from this group and stop receiving emails from it, send 
> an 
> > email to [email protected] <javascript:>. 
> > To view this discussion on the web visit 
> > 
> https://groups.google.com/d/msgid/leo-editor/d03f3fa6-6ebb-4cf4-90f1-c73b128c44b7%40googlegroups.com.
>  
>
> > 
>

-- 
You received this message because you are subscribed to the Google Groups 
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/leo-editor/75b65033-8868-42f9-9954-f56e681fd3b6%40googlegroups.com.

Attachment: web-porject-template.leo
Description: Binary data

Reply via email to