Skip to content

lps init

lps init creates a loopress.json file in the current directory. Run it once at the root of each project you want to manage with Loopress.

Terminal window
lps init

The command is interactive: it prompts you for each field and writes the result to loopress.json.

Prompt Description
WordPress project Select a project you have already configured with lps project config, or enter a project ID manually. When no project exists yet, lps init offers to run lps project config right away and continues with the project you create.
Root directory Base directory for the project. All other paths are resolved relative to it. Defaults to ..

It also adds * text=auto eol=lf at the top of a .gitattributes file next to loopress.json. It creates the file if needed, leaves it alone if the rule is already there, and keeps your own rules after it so they still take precedence (for example *.bat text eol=crlf). Git for Windows checks files out with CRLF line endings by default, so without this rule a snippet cloned on Windows would no longer match, byte for byte, what pull writes.

lps init doesn’t ask for resource directories. Snippets, ACF, hooks, pages and every other resource use their default directory under the root (snippets/, acf/, hooks/, and so on). To use another name, add the matching <kind>Dir key to loopress.json, for example "snippetsDir": "code".

The final summary lists what was configured and the next useful command.

{
"projectId": "my-site",
"rootDir": "."
}

Commit this file to Git. It ties the repository to a specific Loopress project and controls where every command reads and writes files. Every field, including the resource directories you can override, is documented in the loopress.json reference.

lps init will ask whether to overwrite the existing file. Choose No to keep the current config and abort.

Terminal window
# Pull everything already on the site: snippets, plugins, ACF, hooks, and more
lps pull
# Commit everything
git add .
git commit -m "chore: add loopress config"