diff --git a/app/Console/Commands/clientAssetGenerator.php b/app/Console/Commands/clientAssetGenerator.php index 7a84c68..bf34f38 100644 --- a/app/Console/Commands/clientAssetGenerator.php +++ b/app/Console/Commands/clientAssetGenerator.php @@ -3,6 +3,7 @@ namespace App\Console\Commands; use Illuminate\Console\Command; +use Illuminate\Support\Facades\File; class clientAssetGenerator extends Command { @@ -25,6 +26,36 @@ class clientAssetGenerator extends Command */ public function handle() { - // + // make gfx variable + $gfxes = gfx(); + $vars['xshop-background'] = $gfxes['background'] ?? '#000000'; + $vars['xshop-primary'] = $gfxes['primary'] ?? '#6e0000'; + $vars['xshop-secondary'] = $gfxes['secondary'] ?? '#ff0000'; + $vars['xshop-text'] = $gfxes['text'] ?? '#111111'; + $vars['border-radius'] = $gfxes['border-radius'] ?? '7px'; + $vars['xshop-shadow'] = $gfxes['shadow'] ?? '2px 2px 4px #777777'; + + // prepare client.scss and add gfx variable + $variables = "// PLEASE DO NOT EDIT THIS FILE, \n// IF YOU WANT ADD ANY CODE CREATE NEW SCSS INTO client-custom" . PHP_EOL; + $variables .= ":root{" . PHP_EOL; + foreach ($vars as $k => $var) { + $variables .= "--$k:$var;" . PHP_EOL; + } + $variables .= "}" . PHP_EOL . PHP_EOL; + + // add custom scss + $files = File::allFiles(resource_path() . '/sass/client-custom'); + + foreach ($files as $file) { + if ($file->getType() == 'file' && $file->getExtension() == 'scss'){ + $variables .= '@import "client-custom/'. + substr(trim($file->getBasename(),'_'),0,-5) + .'";'.PHP_EOL; + } + + } + + // save scss + file_put_contents(resource_path() . '/sass/client.scss', $variables); } } diff --git a/app/Console/Commands/makePart.php b/app/Console/Commands/makePart.php index 6678012..8ed9ca2 100644 --- a/app/Console/Commands/makePart.php +++ b/app/Console/Commands/makePart.php @@ -51,7 +51,7 @@ class makePart extends Command } - $folderPath = __DIR__ . '/../../../resources/views/segments/' . $section . '/' . $part; + $folderPath = resource_path() . '/views/segments/' . $section . '/' . $part; // check is exists diff --git a/app/Http/Controllers/Admin/GfxController.php b/app/Http/Controllers/Admin/GfxController.php index 5433ae8..4b180b1 100644 --- a/app/Http/Controllers/Admin/GfxController.php +++ b/app/Http/Controllers/Admin/GfxController.php @@ -21,6 +21,7 @@ class GfxController extends Controller $g->save(); } logAdmin(__METHOD__,__CLASS__,null); + \Artisan::call('client'); return redirect()->back()->with(['message' => __('GFX of website updated')]); } } diff --git a/resources/sass/client-custom/_assetsNode.scss b/resources/sass/client-custom/_assetsNode.scss new file mode 100644 index 0000000..c122727 --- /dev/null +++ b/resources/sass/client-custom/_assetsNode.scss @@ -0,0 +1 @@ +@import "remixicon/fonts/remixicon.css"; diff --git a/resources/sass/client-custom/_test.scss b/resources/sass/client-custom/_test.scss new file mode 100644 index 0000000..a6f9a95 --- /dev/null +++ b/resources/sass/client-custom/_test.scss @@ -0,0 +1,9 @@ +body{ + background: var(--xshop-background); + color: var(--xshop-text); +} + +h1{ + color: var(--xshop-primary); + text-shadow: var(--xshop-shadow); +} diff --git a/resources/sass/client.scss b/resources/sass/client.scss index 9b39b76..3f08df3 100644 --- a/resources/sass/client.scss +++ b/resources/sass/client.scss @@ -1,5 +1,13 @@ -*{ - padding: 0; - margin: 0; +// PLEASE DO NOT EDIT THIS FILE, +// IF YOU WANT ADD ANY CODE CREATE NEW SCSS INTO client-custom +:root{ +--xshop-background:#eeeeee; +--xshop-primary:#81c700; +--xshop-secondary:#00eeff; +--xshop-text:#111111; +--border-radius:7px; +--xshop-shadow:5px 10px 31px #ff00f7; } +@import "client-custom/assetsNode"; +@import "client-custom/test"; diff --git a/resources/views/welcome.blade.php b/resources/views/welcome.blade.php index ae1512b..47591bd 100644 --- a/resources/views/welcome.blade.php +++ b/resources/views/welcome.blade.php @@ -11,6 +11,7 @@

xshop +