Compiles source Javascript, CSS (SCSS), and image files into distributable files. The command uses the .staticrc
file to understand where to find the source files and where to output the distribution files.
Types
If no type
is provided, Static will default to all
.
all
Compiles all CSS (SCSS), Javascript, and Images.
css
Compiles CSS (SCSS) files.
js
Compiles Javascript files.
images
Copies, optimizes, and creates .webp
versions of images.
Options
--dir=<directory>
A relative path to a directory with a valid .staticrc
file. Defaults to the current directory.
--watch
Watch the src
directories for changes and recompile when applicable. This option only works with the all
type.
Examples
# Compile all static assets (easiest way) $ static Static SUCCESS: CSS done! Static SUCCESS: JS done! Static SUCCESS: Images copied and optimized! # Compile all static assets (alternative method) $ static all Static SUCCESS: CSS done! Static SUCCESS: JS done! Static SUCCESS: Images copied and optimized! # Compile all and watch for changes $ static --watch Static SUCCESS: CSS done! Static SUCCESS: JS done! Static SUCCESS: Images copied and optimized! Static INFO: Watching files... # Compile all from a different directory $ static --dir=example Static SUCCESS: CSS done! Static SUCCESS: JS done! Static SUCCESS: Images copied and optimized! # Compile CSS $ static css Static SUCCESS: CSS done! # Compile Javascript $ static js Static SUCCESS: JS done! # Compile Images $ static images Static SUCCESS: Images copied and optimized!