added client asset generator [WIP]

pull/44/head
A1Gard 3 months ago
parent 56e7c39248
commit 7552e86c6b

@ -3,6 +3,7 @@
namespace App\Console\Commands; namespace App\Console\Commands;
use Illuminate\Console\Command; use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;
class clientAssetGenerator extends Command class clientAssetGenerator extends Command
{ {
@ -25,6 +26,36 @@ class clientAssetGenerator extends Command
*/ */
public function handle() 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);
} }
} }

@ -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 // check is exists

@ -21,6 +21,7 @@ class GfxController extends Controller
$g->save(); $g->save();
} }
logAdmin(__METHOD__,__CLASS__,null); logAdmin(__METHOD__,__CLASS__,null);
\Artisan::call('client');
return redirect()->back()->with(['message' => __('GFX of website updated')]); return redirect()->back()->with(['message' => __('GFX of website updated')]);
} }
} }

@ -0,0 +1 @@
@import "remixicon/fonts/remixicon.css";

@ -0,0 +1,9 @@
body{
background: var(--xshop-background);
color: var(--xshop-text);
}
h1{
color: var(--xshop-primary);
text-shadow: var(--xshop-shadow);
}

@ -1,5 +1,13 @@
*{ // PLEASE DO NOT EDIT THIS FILE,
padding: 0; // IF YOU WANT ADD ANY CODE CREATE NEW SCSS INTO client-custom
margin: 0; :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";

@ -11,6 +11,7 @@
<body> <body>
<h1> <h1>
xshop xshop
<i class="ri-check-double-line"></i>
</h1> </h1>
</body> </body>
</html> </html>

Loading…
Cancel
Save