Skip to main content

SourcePipeline

Struct SourcePipeline 

Source
pub struct SourcePipeline { /* private fields */ }
Expand description

Routes source-folder file changes to the pipeline that turns them into served output.

The watcher layer runs over source folders only. The designated output dir is never watched and never a trigger: every pipeline below writes its own output, and a pipeline that listened to its own output would re-trigger itself forever (the feedback-loop bug this design fixes). Instead, after a build finishes, the pipeline broadcasts the reload event for the output it wrote, so the browser still hot-swaps/reloads.

CSS and JS are each independently configured via an optional (tool, options) pair. options.bundle() selects between two disjoint modes per language: bundle (a single discovered/entry-driven output, rebuilt in full on any relevant change) or per-file (every source file mirrored independently into the output dir).

asset_folders are a third, simpler kind of source: every file under one (any extension, no transformation) is mirrored byte-identical into the output dir, preserving its path relative to the asset folder — for hand-authored static files (index.html, images) that should live outside the served/output dir as source, same separation the CSS/JS pipelines already have, without needing a CSS/JS tool.

Implementations§

Source§

impl SourcePipeline

Source

pub fn new( source_folders: Vec<PathBuf>, bundle_roots: Vec<PathBuf>, asset_folders: Vec<PathBuf>, output_dir: PathBuf, css_tool: Option<(CssTool, CssOptions)>, js_tool: Option<(JsTool, JsOptions)>, prune_output: bool, broadcaster: Broadcaster, ) -> Self

Source

pub fn full_build(&self) -> Result<(), SourceError>

Rebuild every enabled output once, then prune stale output if configured.

Runs at server startup. Never during live-reload — see Self::prune_stale_output.

Source

pub fn process_change( &self, path: &Path, change_type: &ChangeType, ) -> Result<(), SourceError>

Handle a single change event for path (which must be under a watched source folder or import root), rebuilding output as needed and broadcasting the reload event for whatever was written.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.