diff --git a/src/ConfigFileFixer.php b/src/ConfigFileFixer.php
index 1aabf1b..8c92a2b 100644
--- a/src/ConfigFileFixer.php
+++ b/src/ConfigFileFixer.php
@@ -67,7 +67,7 @@ protected function fixForVersion1_0()
//1: get options{} values and add em to root of 'module.exports' and add last value as theme: {..
preg_match('/options:\s*\{([^\}]+)\},?/', $this->searchAndReplace->get(), $match);
$options = $match[1] ?? '';
- $updatedToThemeKey = "module.exports = {\n" . $options . "\n\ntheme: {\n";
+ $updatedToThemeKey = "module.exports = {\n".$options."\n\ntheme: {\n";
$this->searchAndReplace->perform('options:\s*\{([^\}]+)\},?', '', SearchAndReplace::NO_ESCAPE);
$this->searchAndReplace->perform('module.exports\s*=\s*\{', $updatedToThemeKey, SearchAndReplace::NO_ESCAPE);
@@ -95,12 +95,12 @@ protected function fixForVersion1_0()
'lists\:{regex_line}' => "listStylePosition:{regex_line}\nlistStyleType:{regex_line}",
'position\:{regex_line}' => "position:{regex_line}\ninset:{regex_line}",
'whitespace\:{regex_line}' => "whitespace:{regex_line}\nwordBreak:{regex_line}",
- 'textStyle\:{regex_line}' => "fontStyle:{regex_line}\nfontSmoothing:{regex_line}" .
+ 'textStyle\:{regex_line}' => "fontStyle:{regex_line}\nfontSmoothing:{regex_line}".
"\ntextDecoration:{regex_line}\ntextTransform:{regex_line}",
- 'flexbox\:{regex_line}' => "flexDirection:{regex_line}\nflexWrap:{regex_line}" .
- "\nalignItems:{regex_line}\nalignSelf:{regex_line}" .
- "\njustifyContent:{regex_line}\nalignContent:{regex_line}" .
- "\nflex:{regex_line}\nflexGrow:{regex_line}" .
+ 'flexbox\:{regex_line}' => "flexDirection:{regex_line}\nflexWrap:{regex_line}".
+ "\nalignItems:{regex_line}\nalignSelf:{regex_line}".
+ "\njustifyContent:{regex_line}\nalignContent:{regex_line}".
+ "\nflex:{regex_line}\nflexGrow:{regex_line}".
"\nflexShrink:{regex_line}",
];
@@ -114,46 +114,46 @@ protected function fixForVersion1_0()
$containerOptions = $match[1] ?? '';
$this->searchAndReplace->perform('require\(\'tailwindcss\/plugins\/container\'\)\(\{([^\}]+)\}\),?', '', SearchAndReplace::NO_ESCAPE);
- $corePlugins = 'corePlugins: {' . (empty($containerOptions) ? "\ncontainer: false," : '') . "\n}, \nplugins: [";
+ $corePlugins = 'corePlugins: {'.(empty($containerOptions) ? "\ncontainer: false," : '')."\n}, \nplugins: [";
$this->searchAndReplace->perform('plugins:\s*\[', $corePlugins, SearchAndReplace::NO_ESCAPE);
- $this->searchAndReplace->perform('theme:\s*\{', "theme: \n{\ncontainer: {\n" . $containerOptions . "\n},\n", SearchAndReplace::NO_ESCAPE);
+ $this->searchAndReplace->perform('theme:\s*\{', "theme: \n{\ncontainer: {\n".$containerOptions."\n},\n", SearchAndReplace::NO_ESCAPE);
//8: fix colors
- $colors = "\n transparent: 'transparent',\n\n black: '#000',\n white: '#fff'," .
- "\n gray: {\n100: '#f7fafc',\n200: '#edf2f7',\n300: '#e2e8f0'," .
- "\n400: '#cbd5e0',\n500: '#a0aec0',\n600: '#718096',\n700: '#4a5568'," .
- "\n800: '#2d3748',\n900: '#1a202c',\n},\n" .
- "\n red: {\n100: '#fff5f5',\n200: '#fed7d7',\n300: '#feb2b2',\n400: '#fc8181'," .
- "\n500: '#f56565',\n600: '#e53e3e',\n700: '#c53030',\n800: '#9b2c2c'," .
- "\n900: '#742a2a',\n},\n" .
- "\n orange: {\n100: '#fffaf0',\n200: '#feebc8',\n300: '#fbd38d'," .
- "\n400: '#f6ad55',\n500: '#ed8936',\n600: '#dd6b20',\n700: '#c05621'," .
- "\n800: '#9c4221',\n900: '#7b341e',\n},\n" .
- "\n yellow: {\n100: '#fffff0',\n200: '#fefcbf',\n300: '#faf089'," .
- "\n400: '#f6e05e',\n500: '#ecc94b',\n600: '#d69e2e',\n700: '#b7791f'," .
- "\n800: '#975a16',\n900: '#744210',\n},\n" .
- "\n green: {\n100: '#f0fff4',\n200: '#c6f6d5',\n300: '#9ae6b4'," .
- "\n400: '#68d391',\n500: '#48bb78',\n600: '#38a169',\n700: '#2f855a'," .
- "\n800: '#276749',\n900: '#22543d',\n}," .
- "\n teal: {\n100: '#e6fffa',\n200: '#b2f5ea',\n300: '#81e6d9'," .
- "\n400: '#4fd1c5',\n500: '#38b2ac',\n600: '#319795',\n700: '#2c7a7b'," .
- "\n800: '#285e61',\n900: '#234e52',\n},\n" .
- "\n blue: {\n100: '#ebf8ff',\n200: '#bee3f8',\n300: '#90cdf4'," .
- "\n400: '#63b3ed',\n500: '#4299e1',\n600: '#3182ce',\n700: '#2b6cb0', " .
- "\n800: '#2c5282',\n900: '#2a4365',\n}," .
- "\n indigo: {\n100: '#ebf4ff',\n200: '#c3dafe',\n300: '#a3bffa'," .
- "\n400: '#7f9cf5',\n500: '#667eea',\n600: '#5a67d8',\n700: '#4c51bf'," .
- "\n800: '#434190',\n900: '#3c366b',\n},\n" .
- "\n purple: {\n100: '#faf5ff',\n200: '#e9d8fd',\n300: '#d6bcfa'," .
- "\n400: '#b794f4',\n500: '#9f7aea',\n600: '#805ad5',\n700: '#6b46c1'," .
- "\n800: '#553c9a',\n900: '#44337a',\n},\n" .
- "\n pink: {\n100: '#fff5f7',\n200: '#fed7e2',\n300: '#fbb6ce'," .
- "\n400: '#f687b3',\n500: '#ed64a6',\n600: '#d53f8c',\n700: '#b83280'," .
+ $colors = "\n transparent: 'transparent',\n\n black: '#000',\n white: '#fff',".
+ "\n gray: {\n100: '#f7fafc',\n200: '#edf2f7',\n300: '#e2e8f0',".
+ "\n400: '#cbd5e0',\n500: '#a0aec0',\n600: '#718096',\n700: '#4a5568',".
+ "\n800: '#2d3748',\n900: '#1a202c',\n},\n".
+ "\n red: {\n100: '#fff5f5',\n200: '#fed7d7',\n300: '#feb2b2',\n400: '#fc8181',".
+ "\n500: '#f56565',\n600: '#e53e3e',\n700: '#c53030',\n800: '#9b2c2c',".
+ "\n900: '#742a2a',\n},\n".
+ "\n orange: {\n100: '#fffaf0',\n200: '#feebc8',\n300: '#fbd38d',".
+ "\n400: '#f6ad55',\n500: '#ed8936',\n600: '#dd6b20',\n700: '#c05621',".
+ "\n800: '#9c4221',\n900: '#7b341e',\n},\n".
+ "\n yellow: {\n100: '#fffff0',\n200: '#fefcbf',\n300: '#faf089',".
+ "\n400: '#f6e05e',\n500: '#ecc94b',\n600: '#d69e2e',\n700: '#b7791f',".
+ "\n800: '#975a16',\n900: '#744210',\n},\n".
+ "\n green: {\n100: '#f0fff4',\n200: '#c6f6d5',\n300: '#9ae6b4',".
+ "\n400: '#68d391',\n500: '#48bb78',\n600: '#38a169',\n700: '#2f855a',".
+ "\n800: '#276749',\n900: '#22543d',\n},".
+ "\n teal: {\n100: '#e6fffa',\n200: '#b2f5ea',\n300: '#81e6d9',".
+ "\n400: '#4fd1c5',\n500: '#38b2ac',\n600: '#319795',\n700: '#2c7a7b',".
+ "\n800: '#285e61',\n900: '#234e52',\n},\n".
+ "\n blue: {\n100: '#ebf8ff',\n200: '#bee3f8',\n300: '#90cdf4',".
+ "\n400: '#63b3ed',\n500: '#4299e1',\n600: '#3182ce',\n700: '#2b6cb0', ".
+ "\n800: '#2c5282',\n900: '#2a4365',\n},".
+ "\n indigo: {\n100: '#ebf4ff',\n200: '#c3dafe',\n300: '#a3bffa',".
+ "\n400: '#7f9cf5',\n500: '#667eea',\n600: '#5a67d8',\n700: '#4c51bf',".
+ "\n800: '#434190',\n900: '#3c366b',\n},\n".
+ "\n purple: {\n100: '#faf5ff',\n200: '#e9d8fd',\n300: '#d6bcfa',".
+ "\n400: '#b794f4',\n500: '#9f7aea',\n600: '#805ad5',\n700: '#6b46c1',".
+ "\n800: '#553c9a',\n900: '#44337a',\n},\n".
+ "\n pink: {\n100: '#fff5f7',\n200: '#fed7e2',\n300: '#fbb6ce',".
+ "\n400: '#f687b3',\n500: '#ed64a6',\n600: '#d53f8c',\n700: '#b83280',".
"\n800: '#97266d',\n900: '#702459',\n},\n";
$this->searchAndReplace->perform('let colors\s*=\s*\{([^\}]+)\}', '', SearchAndReplace::NO_ESCAPE);
- $this->searchAndReplace->perform('\s+colors:\s*colors', ' colors: {' . $colors . '}', SearchAndReplace::NO_ESCAPE);
+ $this->searchAndReplace->perform('\s+colors:\s*colors', ' colors: {'.$colors.'}', SearchAndReplace::NO_ESCAPE);
$this->searchAndReplace->perform('backgroundColor:\s*colors', 'backgroundColor: theme => theme(\'colors\')', SearchAndReplace::NO_ESCAPE);
$this->searchAndReplace->perform('textColor:\s*colors', 'textColor: theme => theme(\'colors\')', SearchAndReplace::NO_ESCAPE);
$this->searchAndReplace->perform('borderColor:\s*g([^\n]+)', "borderColor: theme => {\nreturn global.Object.assign({ default: theme('colors.gray.300', 'currentColor') }, theme('colors'))\n},", SearchAndReplace::NO_ESCAPE);
diff --git a/src/ConsoleHelper.php b/src/ConsoleHelper.php
index 73ceabb..cc71150 100644
--- a/src/ConsoleHelper.php
+++ b/src/ConsoleHelper.php
@@ -23,7 +23,7 @@ public function __construct(OutputInterface $output, $recursive, $overwrite, $ex
public function folderConvert($folderPath)
{
- $this->output->writeln('Start Converting Folder: ' . $folderPath);
+ $this->output->writeln('Start Converting Folder: '.$folderPath);
if ($this->recursive) {
$iterator = new \RecursiveIteratorIterator(
@@ -53,7 +53,7 @@ public function fileConvert($filePath, $extension)
$filePath = realpath($filePath);
if (!is_file($filePath)) {
- $this->output->writeln('Couldn\'t convert: ' . basename($filePath));
+ $this->output->writeln('Couldn\'t convert: '.basename($filePath));
return;
}
@@ -65,7 +65,7 @@ public function fileConvert($filePath, $extension)
if ($lastDotPosition !== false && !$this->overwrite) {
$newFilePath = substr_replace($filePath, '.tw', $lastDotPosition, 0);
} elseif (!$this->overwrite) {
- $newFilePath = $filePath . '.tw';
+ $newFilePath = $filePath.'.tw';
} else {
// Set the new path to the old path to make sure we overwrite it
$newFilePath = $filePath;
@@ -78,11 +78,11 @@ public function fileConvert($filePath, $extension)
->get();
if ($content !== $newContent) {
- $this->output->writeln('Converted: ' . basename($newFilePath));
+ $this->output->writeln('Converted: '.basename($newFilePath));
file_put_contents($newFilePath, $newContent);
} else {
- $this->output->writeln('Nothing to convert: ' . basename($filePath));
+ $this->output->writeln('Nothing to convert: '.basename($filePath));
}
}
@@ -93,7 +93,7 @@ public function codeConvert($code)
->convert()
->get();
- $this->output->writeln('Converted Code: ' . $convertedCode);
+ $this->output->writeln('Converted Code: '.$convertedCode);
}
public function fixTailwindConfig($filePath)
@@ -109,7 +109,7 @@ public function fixTailwindConfig($filePath)
if ($lastDotPosition !== false && !$this->overwrite) {
$newFilePath = substr_replace($filePath, '.tw', $lastDotPosition, 0);
} elseif (!$this->overwrite) {
- $newFilePath = $filePath . '.tw';
+ $newFilePath = $filePath.'.tw';
} else {
// Set the new path to the old path to make sure we overwrite it
$newFilePath = $filePath;
diff --git a/src/SearchAndReplace.php b/src/SearchAndReplace.php
index 601e0a5..24068ad 100644
--- a/src/SearchAndReplace.php
+++ b/src/SearchAndReplace.php
@@ -124,9 +124,9 @@ public function perform($search, $replace, $options = null)
) {
$currentSubstitute++;
foreach (['regex_string' => '[a-zA-Z0-9]+', 'regex_number' => '[0-9]+', 'regex_line' => '[^\n]+'] as $regexName => $regexValue) {
- $regexMatchCount = preg_match_all('/\\\\?\{' . $regexName . '\\\\?\}/', $search);
- $search = preg_replace('/\\\\?\{' . $regexName . '\\\\?\}/', '(?<' . substr($regexName, 6) . '_' . $currentSubstitute . '>' . $regexValue . ')', $search, 1);
- $replace = preg_replace('/\\\\?\{' . $regexName . '\\\\?\}/', '${' . substr($regexName, 6) . '_' . $currentSubstitute . '}', $replace, $regexMatchCount > 1 ? 1 : -1);
+ $regexMatchCount = preg_match_all('/\\\\?\{'.$regexName.'\\\\?\}/', $search);
+ $search = preg_replace('/\\\\?\{'.$regexName.'\\\\?\}/', '(?<'.substr($regexName, 6).'_'.$currentSubstitute.'>'.$regexValue.')', $search, 1);
+ $replace = preg_replace('/\\\\?\{'.$regexName.'\\\\?\}/', '${'.substr($regexName, 6).'_'.$currentSubstitute.'}', $replace, $regexMatchCount > 1 ? 1 : -1);
}
continue;
}
@@ -136,13 +136,13 @@ public function perform($search, $replace, $options = null)
//class=" given given-md something-given-md"
$this->givenContent = preg_replace_callback(
- '/' . $regexStart . '(?(?(?givenContent
);
diff --git a/src/Updater.php b/src/Updater.php
index 00e1233..64bdeaa 100644
--- a/src/Updater.php
+++ b/src/Updater.php
@@ -149,15 +149,14 @@ protected function convertToVersion1_0()
foreach ($classes as $beforeClass => $afterClass) {
$this->searchAndReplace->perform(
- ($isCSSfile ? '.' : '') . $beforeClass,
- ($isCSSfile ? '.' : '') . $afterClass,
+ ($isCSSfile ? '.' : '').$beforeClass,
+ ($isCSSfile ? '.' : '').$afterClass,
$isCSSfile ? SearchAndReplace::AFTER_APPLY_DIRECTIVE : SearchAndReplace::INSIDE_CLASSE_PROP
);
}
//empty variant
- $this->searchAndReplace->perform(($isCSSfile ? '\.' : '(?>[a-z]+:)?') . 'no-underline', '', SearchAndReplace::NO_ESCAPE);
-
+ $this->searchAndReplace->perform(($isCSSfile ? '\.' : '(?>[a-z]+:)?').'no-underline', '', SearchAndReplace::NO_ESCAPE);
if ($isCSSfile) {
return;