ThemeWriter

Implements \ThemeWriterInterface

Class ThemeWriter publish theme and create cache and compile template 5.55 s publish theme and compile template 3.62 s compile template 2.63, 2.78, 2.69, normal 0.676s

package

Default

Methods

ThemeWriter constructor.

__construct(\FilesystemAdapter $filesystem, \ExistingDirectory $shopSource) 

Arguments

$filesystem

\FilesystemAdapter

$shopSource

\ExistingDirectory

_appendFileContent

_appendFileContent( $destinationFile,  $sourceFile) 
Throws
\FileNotFoundException

Arguments

$destinationFile

$sourceFile

_applyActiveThemeVariants

_applyActiveThemeVariants(\IdentifiedThemeInterface $theme, \ThemeDirectoryRootInterface $destination, \Gambio\StyleEdit\Core\Repositories\Entities\ConfigurationCollection $variants) : boolean|\CustomThemeCopyResponse
Throws
\FileNotFoundException

Arguments

$variants

\Gambio\StyleEdit\Core\Repositories\Entities\ConfigurationCollection

Response

boolean|\CustomThemeCopyResponse

_copyCustomHtmlDirectory

_copyCustomHtmlDirectory(\IdentifiedThemeInterface $theme,  $directory, \ThemeDirectoryRootInterface $destination) : boolean|\CustomThemeCopyResponse|mixed
Throws
\FileNotFoundException

Arguments

$directory

Response

boolean|\CustomThemeCopyResponse|mixed

_copyCustomJsDirectory

_copyCustomJsDirectory(\ThemeId $themeId,  $directory, \ThemeDirectoryRootInterface $destination) 
Throws
\FileNotFoundException

Arguments

$themeId

\ThemeId

$directory

_copyCustomStylesDirectory

_copyCustomStylesDirectory(\ThemeId $themeId,  $directory, \ThemeDirectoryRootInterface $destination) 
Throws
\FileNotFoundException

Arguments

$themeId

\ThemeId

$directory

_copyMainThemeDirectory

_copyMainThemeDirectory(\ThemeId $themeId, \ThemeDirectoryInterface $directory, \ThemeDirectoryRootInterface $destination) 

Arguments

$themeId

\ThemeId

_copyMainThemeStyleEditDirectory

_copyMainThemeStyleEditDirectory(\ThemeId $themeId, \ThemeDirectoryInterface $directory, \ThemeDirectoryRootInterface $destination) 

Arguments

$themeId

\ThemeId

_copySettingsJson

_copySettingsJson(\VariableThemeDirectoriesInterface $theme, \ThemeDirectoryRootInterface $destination) 
Throws
\Exception

Arguments

_copyStyleEditThemeDirectory

_copyStyleEditThemeDirectory(\ThemeId $themeId,  $directory, \ThemeDirectoryRootInterface $destination) 
Throws
\FileNotFoundException

Arguments

$themeId

\ThemeId

$directory

_copyThemeDirectory

_copyThemeDirectory(\ThemeId $themeId,  $directory, \ThemeDirectoryRootInterface $destination) 
Throws
\FileNotFoundException

Arguments

$themeId

\ThemeId

$directory

_copyThemeFontsDirectory

_copyThemeFontsDirectory(\ThemeId $themeId,  $fontsDirectory, \ThemeDirectoryRootInterface $destination) 
Throws
\FileNotFoundException

Arguments

$themeId

\ThemeId

$fontsDirectory

_copyThemeImagesDirectory

_copyThemeImagesDirectory(\ThemeId $themeId,  $imagesDirectory, \ThemeDirectoryRootInterface $destination) 
Throws
\FileNotFoundException

Arguments

$themeId

\ThemeId

$imagesDirectory

_copyThemeJson

_copyThemeJson(\VariableThemeDirectoriesInterface $theme, \ThemeDirectoryRootInterface $destination) 
Throws
\Exception

Arguments

_endsWith

_endsWith( $haystack,  $needle) : boolean

Arguments

$haystack

$needle

Response

boolean

_extendHtmlFile

_extendHtmlFile( $sourceFile,  $destinationFile,  $suffix) : mixed
Throws
\FileNotFoundException

Arguments

$sourceFile

$destinationFile

$suffix

Response

mixed

_getRelative

_getRelative(\ThemeDirectoryRootInterface $directory) : mixed

Arguments

Response

mixed

_loadActiveVariants

_loadActiveVariants(\ThemeDirectoryRootInterface $destination) : \Gambio\StyleEdit\Core\Repositories\Entities\ConfigurationCollection
Throws
\Exception

Arguments

Response

\Gambio\StyleEdit\Core\Repositories\Entities\ConfigurationCollection

_overloadVariantDirectory

_overloadVariantDirectory(\VariantDirectories $variant, \ThemeDirectoryRootInterface $destination) : boolean|\CustomThemeCopyResponse|mixed
Throws
\FileNotFoundException

Arguments

Response

boolean|\CustomThemeCopyResponse|mixed

_saveMainTheme

_saveMainTheme(\MainThemeInterface $mainTheme, \ThemeDirectoryRootInterface $destination) 

Arguments

$mainTheme

\MainThemeInterface

_saveTheme

_saveTheme(\ThemeInterface $theme, \ThemeDirectoryRootInterface $destination) : boolean|\CustomThemeCopyResponse|mixed
Throws
\FileNotFoundException

Arguments

Response

boolean|\CustomThemeCopyResponse|mixed

_saveThemeStructure

_saveThemeStructure(\MainThemeInterface $mainTheme, \ThemeDirectoryRootInterface $destination, \ThemeInterface $childThemes) 
Throws
\FileNotFoundException

Arguments

$mainTheme

\MainThemeInterface

$childThemes

\ThemeInterface

_stringAfter

_stringAfter( $searchFor,  $subject) : boolean|string

Arguments

$searchFor

$subject

Response

boolean|string

_stringReplaceFirst

_stringReplaceFirst( $search,  $replace,  $subject) : string

Arguments

$search

$replace

$subject

Response

string

applyHtmlOverloads

applyHtmlOverloads(\CustomThemeCopyResponse $overloaders, \ThemeDirectoryRootInterface $destination) : boolean|\CustomThemeCopyResponse
Throws
\FileNotFoundException

Arguments

Response

boolean|\CustomThemeCopyResponse

Creates a duplicate of a file with .min if only the source file exists or a file without .min if only the .min file exists

duplicateFilesThatHaveNoMatchingMinOrSourceFile(array<mixed,string> $files) 

Arguments

$files

array<mixed,string>

Checks the $themeDirectoryRoot (/public/theme) for files that have no matching source or .min file

findFilesThatHaveNoMatchingMinOrSourceFile(\ThemeDirectoryRootInterface $themeDirectoryRoot) 

Arguments

$themeDirectoryRoot

\ThemeDirectoryRootInterface

findScriptsAndSheetsInDirectory

findScriptsAndSheetsInDirectory(\StringType $directory) : array<mixed,string>

Arguments

$directory

\StringType

Response

array<mixed,string>

getRelativeFromFile

getRelativeFromFile(\ExistingFile $file) : string

Arguments

Response

string

Modifies the path if a file would be placed inside the root of the custom directory. The file will be moved inside the global directory of system directory

moveJsFromCustomRootDirectoryToCustomGlobalDirectory(string $path, string $source) : string

This method is only called for child themes

Arguments

$path

string

$source

string

Response

string

mixed

replaceCustomInPath

replaceCustomInPath(string $path) : string

Arguments

$path

string

Response

string

Saves the given them to the destination.

save(\ThemeInterface $theme, \ThemeDirectoryRootInterface $destination) : void
Throws
\Exception

Arguments

$theme

\ThemeInterface

Theme to be saved.

$destination

\ThemeDirectoryRootInterface

Destination directory.

Constants

FILE_IS_SCRIPT_OR_SHEET_PATTERN

FILE_IS_SCRIPT_OR_SHEET_PATTERN

UNMINIFIED_FILE_NAME_PATTERN

UNMINIFIED_FILE_NAME_PATTERN

Properties

filesystem

filesystem : 

Type(s)

shopSource

shopSource : 

Type(s)

sourceThemeId

sourceThemeId : 

Type(s)