Skip to the content
Documentation

exp:exptemplateconverttwigtostpl

No ratings yet

Available since Exponential 6.0.15 (in development, not in a release yet).

Summary

Convert the Twig templates (.twig) of a design to Smarty templates (.stpl); --dry-run, --file, --force, --override-ini

Usage

./console exp:exptemplateconverttwigtostpl [options]
php bin/php/exptemplateconverttwigtostpl.php [options]
./console exp:template:convert:twig-to-stpl [options]

Aliases

exp:template:convert:twig-to-stpl

Help

The output of ./console help exp:exptemplateconverttwigtostpl (the script run with --help), without the standard options:

Usage: bin/php/exptemplateconverttwigtostpl.php [OPTION]...
Convert Twig templates (.twig) to Smarty templates (.stpl)
Every *.twig below --from becomes the *.stpl at the same place below --to (templates/ and
override/templates/ alike), so that it prints what the .twig printed.
A .html.twig is read as the template of its name without .html. The .twig is converted to Exponential
templates and then to Smarty, in memory, in one run.
--override-ini writes the override rules that make the -s siteaccess use the .stpl.
The same as exp:template:convert --from-engine=twig --to-engine=stpl.

./console exp:template:convert:twig-to-stpl --from=extension/<ext>/design/<design> --to=var/tmp/<design>
./console exp:template:convert:twig-to-stpl --from=extension/<ext>/design/<design> --dry-run
./console exp:template:convert:twig-to-stpl --file=design/<design>/templates/<name>.twig
./console exp:template:convert:twig-to-stpl -s <siteaccess> --from=<design> --to=<design> --override-ini=<file>

Every written file ends with a marker comment ({* exp:template:convert twig->stpl md5:... from ... *});
a target that has no marker, or was changed after it was written, is skipped (SKIP) unless --force
is given. The result is checked before it is written: a .stpl must compile with Smarty 5 (when
installed). Prints WRITE or REPLACE for every file written, NOTE for every construct that could not
be converted exactly, ERROR for a template that could not be converted, then PASS or FAIL with the counts.
Exit code: 0 PASS; 1 FAIL (a template could not be read, converted, checked or written); 2 wrong options;
3 the conversion is not available (the engine's library or converter is missing).


Options:
  --from=VALUE          design directory with the .twig templates (every .twig below it is converted)
  --to=VALUE            design directory for the .stpl templates (default: the --from directory, next to the sources)
  --file=VALUE          convert this one .twig only (below --from, or a file of its own: then --to is the target file)
  --override-ini=VALUE  override.ini.append.php to write for the --to design (the -s siteaccess's override rules, MatchFile pointing at the converted .stpl)
  --dry-run             show what would be written; nothing is written
  --force               also replace a .stpl that was changed or written by hand (no marker, or not matching it)

Options

Option Value Description
--from required design directory with the .twig templates (every .twig below it is converted)
--to required design directory for the .stpl templates (default: the --from directory, next to the sources)
--file required convert this one .twig only (below --from, or a file of its own: then --to is the target file)
--override-ini required override.ini.append.php to write for the --to design (the -s siteaccess's override rules, MatchFile pointing at the converted .stpl)
--dry-run - show what would be written; nothing is written
--force - also replace a .stpl that was changed or written by hand (no marker, or not matching it)

Standard options

Every script also takes the standard options of the script framework: --help, --quiet, --siteaccess, --debug, --colors, --no-colors, --logfiles, --no-logfiles, --verbose and --allow-root-user.

Source

bin/php/exptemplateconverttwigtostpl.php, kernel/private/classes/commands/exptemplateconverttwigtostpl.php

See also

Generated example: exp:exptemplateconverttwigtostpl

Added to the reference for Exponential 6.0.15.

Contributors

Comments

Add a comment

Comments are read by a moderator before they appear.