Still.Compiler.Incremental.Node (Still v0.3.1) View Source

An incremental node represents a file, or folder, that is processed individually.

Each file has a list of subscriptions and subcribers. The subscriptions are the files included by the current file. The subscribers are the files that the current file includes. When the current file changes, it notifies the subscribers and updates the subscriptions.

A file can be compiled or rendered:

  • Compile - compiling a file means, most times, running it thorugh a preprocessor and writing to to the destination folder.

  • Render - rendering a file means that the current file is being included by another file. Template files may return HTML and images could return a path.

Incremental nodes attempt to compile/render files synchronously. This process can take a long time, which is usually fine, but it can be changed by setting the :compilation_timeout key in your config/config.exs. Default is :infinity.

Link to this section Summary

Functions

Adds a file to the list of files this process is subscribed to.

Returns a specification to start this module under a supervisor.

Returns the compilation timeout defined in the config.

Compiles the file mapped by the Node with the given PID.

Removes a file from the list of files subscribing to this process.

Renders the file mapped by the Node with the given PID.

Link to this section Functions

Link to this function

add_subscription(pid, file)

View Source

Adds a file to the list of files this process is subscribed to.

Returns a specification to start this module under a supervisor.

See Supervisor.

Returns the compilation timeout defined in the config.

You can change this by setting

config :still, :compilation_timeout, 1_000_000

Compiles the file mapped by the Node with the given PID.

This PID can be obtained from Still.Compiler.Incremental.Registry.

For difference between compilation and renderisation see Still.Compiler.File.

Link to this function

remove_subscriber(pid, file)

View Source

Removes a file from the list of files subscribing to this process.

Link to this function

render(pid, data, subscriber \\ nil)

View Source

Renders the file mapped by the Node with the given PID.

This PID can be obtained from Still.Compiler.Incremental.Registry.

For difference between compilation and renderisation see Still.Compiler.File.