/ /cmd /cmd.plated /cmd.plated.build /cmd.plated.watch/html /html.plated /html.plated.chunks /html.plated.files /html.plated.macros /html.plated.operators/html.plated_plugin /html.plated_plugin.blog /html.plated_plugin.copy /html.plated_plugin.docs /html.plated_plugin.import /html.plated_plugin.redirect/js /js.plated /js.plated.blog /js.plated.build /js.plated.micro /js.plated.plugin /js.plated.setup /js.plated.watch/js.plated_chunks /js.plated_chunks.deepmerge /js.plated_chunks.delimiter_close_str /js.plated_chunks.delimiter_open_str /js.plated_chunks.delimiter_wrap_str /js.plated_chunks.expand_tag /js.plated_chunks.fill_chunks /js.plated_chunks.format_chunks /js.plated_chunks.lookup /js.plated_chunks.lookup_in_namespace /js.plated_chunks.markdown /js.plated_chunks.merge_namespace /js.plated_chunks.pop_namespace /js.plated_chunks.prepare /js.plated_chunks.push_namespace /js.plated_chunks.remove_underscorechunks /js.plated_chunks.replace /js.plated_chunks.replace_once /js.plated_chunks.reset_namespace /js.plated_chunks.set_namespace/js.plated_files /js.plated_files.base_files_to_chunks /js.plated_files.build /js.plated_files.build_file /js.plated_files.empty_cache /js.plated_files.empty_folder /js.plated_files.exists /js.plated_files.file_to_chunks /js.plated_files.filename_fixup /js.plated_files.filename_is_basechunk /js.plated_files.filename_is_plated /js.plated_files.filename_to_dirname /js.plated_files.filename_to_output /js.plated_files.find_dirs /js.plated_files.find_files /js.plated_files.joinpath /js.plated_files.lstat /js.plated_files.mkdir /js.plated_files.prepare_namespace /js.plated_files.readdir /js.plated_files.set_source /js.plated_files.source_to_output /js.plated_files.stat /js.plated_files.trimpath /js.plated_files.watch /js.plated_files.write/js.plated_output /js.plated_output.remember /js.plated_output.remember_and_write /js.plated_output.write /js.plated_output.write_all /js.plated_output.write_map/js.plated_plugin /js.plated_plugin.blog /js.plated_plugin.blog.process_dirs /js.plated_plugin.blog.process_file/js.plated_plugin.copy /js.plated_plugin.copy.process_dirs /js.plated_plugin.copy.process_file /js.plated_plugin.copy.process_output/js.plated_plugin.docs /js.plated_plugin.docs.process_dirs /js.plated_plugin.docs.process_file/js.plated_plugin.import /js.plated_plugin.import.process_file/js.plated_plugin.redirect /js.plated_plugin.redirect.process_dirs /js.plated_plugin.redirect.process_file

js.plated_files

Manage the files that we read from and watch or write to.

This module only exposes one function, which is used to create the actual module with bound state data.

plated_files = require("./plated_files.js").create(opts,plated)

This is called automatically when the plated module is created and the return value is made available in plated.chunks note that all of these modules are bound together and operate as a group with shared data.

In the future when we talk about this module and its available functions we are referring to the return value from this create function.

js.plated_files.base_files_to_chunks

chunks = await plated_files.base_files_to_chunks(fname)

Check this directory and all directories above for generic chunks build all of these into the current chunk namespace for this file.

js.plated_files.build

plated_files.build()

Build all files found in the source dir into the output dir.

js.plated_files.build_file

plated_files.build_file(fname)

Build the given source filename, using chunks or maybe just a raw copy from source into the output.

js.plated_files.empty_cache

plated_files.empty_cache()

Empty the current file cache, we fill it up as read files.

js.plated_files.empty_folder

plated_files.empty_folder(path)

Empty the (output) folder or make it if it does not exist. This is rather dangerous so please be careful.

js.plated_files.exists

await plated_files.exists(path)

Returns true if a file or dir at the given path exists.

js.plated_files.file_to_chunks

chunks = plated_files.file_to_chunks(root,fname,chunks)

Load root/fname or get it from the cache and then turn it into chunks using plated_chunks.fill_chunks(date,chunks) chunks is returned.

js.plated_files.filename_fixup

filename = plated_files.filename_fixup(filename)

Fix the filename, so it becomes an empty string rather than a "." or "/." or "/" this makes it easier to use in urls.

js.plated_files.filename_is_basechunk

bool = plated_files.filename_is_basechunk(filename)

Is this filename part of the basechunks for a dir?

A base chunk is something like ^.html or ^.css all of these files get merged into the base chunks for the directory they are found in. Their extension is ignored and just to help syntax highlighting when the file is viewed.

js.plated_files.filename_is_plated

bool = plated_files.filename_is_plated(filename)

Is this filename something we need to run through plated. Returns true if filename contains the ^ trigger string. This string can be changed by altering opts.hashfile from "^" to something else.

js.plated_files.filename_to_dirname

dirname = plated_files.filename_to_dirname(filename)

Get the dirname of this filename.

js.plated_files.filename_to_output

filename = plated_files.filename_to_output(filename)

Work out the output filename from an input filename, the trigger string "^." gets removed as we process a file.

js.plated_files.find_dirs

plated_files.find_dirs(root,name,func)

Call func(name) with every directory we find inside the root/name directory. We follow symlinks into other directories.

js.plated_files.find_files

plated_files.find_files(root,name)

REturn an array with every file we find inside the root/name directory. We follow symlinks into other directories.

js.plated_files.joinpath

await plated_files.joinpath(...)

join components into a full path.

js.plated_files.lstat

await plated_files.lstat(path)

Return the lstat of this path

js.plated_files.mkdir

plated_files.mkdir(dir)

Create the given dir and recursively create its parent dirs as well if necessary.

js.plated_files.prepare_namespace

plated_files.prepare_namespace(fname)

Check this directory and all directories above for generic chunks then build all of these into the current chunk namespace for this file.

js.plated_files.readdir

await plated_files.readdir(path)

Return the readdir of this path

js.plated_files.set_source

plated_files.set_source(dir)

Fill in _source and related chunks such as.

_sourcename the file that this set of chunks came from.

_filename the output filename.

_dirname the output dirname.

_root the root of the site, normally a relative path to the current directory, eg ../ since some things such as github pages need to exist in a directory rather than the root of a site. This should always be used in html paths, {_root} instead of / to make sure that you always get to the right place and can find your files.

_filename the url path of the filename, eg /dirname/filename

_dirname the url path of the dir this file exists in, eg /dirname

js.plated_files.source_to_output

filename = plated_files.source_to_output(filename)

Convert a source path into an output path.

js.plated_files.stat

await plated_files.stat(path)

Return the stat of this path

js.plated_files.trimpath

plated_files.trimpath(path)

Remove a trailing / from the path

js.plated_files.watch

plated_files.watch()

Build all files found in the source dir into the output dir and then sit watching for changes to these files that would trigger rebuilds.

This does not return, instead the user is expected to ctrl+c when finished.

js.plated_files.write

plated_files.write(filename,data)

Create parent dir if necessary and write the data into this file.