LiveStyle.Compiler.CSS.Writer (LiveStyle v0.13.0)
View SourceFile writing operations for LiveStyle CSS output.
This module handles writing CSS content to files with change detection to avoid unnecessary writes.
Responsibilities
- Writing CSS content to files
- Change detection (skip write if content unchanged)
- Directory creation
For CSS generation, see LiveStyle.Compiler.CSS.Pipeline.
Summary
Functions
Writes CSS to a file if it has changed.
Writes CSS content directly to a file.
Writes content to a file only if it differs from existing content.
Functions
Writes CSS to a file if it has changed.
Generates CSS from the current manifest and writes it to the specified path.
Options
:stats- Include a stats comment at the top of the file (default: true)
Returns
{:ok, :written}- File was written (content changed or file didn't exist){:ok, :unchanged}- File exists with identical content, no write performed{:error, reason}- An error occurred during write
Example
LiveStyle.Compiler.CSS.Writer.write("priv/static/live.css")
LiveStyle.Compiler.CSS.Writer.write("priv/static/live.css", stats: false)
Writes CSS content directly to a file.
Use this when you already have the CSS content and don't need generation.
Returns
{:ok, :written}- File was written{:ok, :unchanged}- File exists with identical content{:error, reason}- An error occurred
Writes content to a file only if it differs from existing content.
Creates parent directories if they don't exist.
Returns
{:ok, :written}- File was written{:ok, :unchanged}- File exists with identical content{:error, reason}- An error occurred