Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F2529002
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
3 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/src/resources/build/before.php b/src/resources/build/before.php
index e7c93285..21b32849 100644
--- a/src/resources/build/before.php
+++ b/src/resources/build/before.php
@@ -1,40 +1,68 @@
<?php
$rootDir = __DIR__ . '/../..';
// Create build directory for js resources
-echo "Build directory...";
+echo "Build directory... ";
if (!file_exists("{$rootDir}/resources/build/js")) {
mkdir("{$rootDir}/resources/build/js");
}
echo "OK\n";
// Write build timestamp to a file that is then included by the vue components
-echo "Build timestamp...";
+echo "Build timestamp... ";
file_put_contents(
"{$rootDir}/resources/build/js/ts.js",
sprintf("export default new Date('%s')", date('c'))
);
echo "OK\n";
// Convert UI localization into vue-i18n-compatible json format
-echo "Client localization...";
+echo "Client localization... ";
foreach (glob("{$rootDir}/resources/lang/*/ui.php") as $file) {
$content = include $file;
if (is_array($content)) {
preg_match('|([a-z]+)/ui\.php$|', $file, $matches);
$file = "{$rootDir}/resources/build/js/{$matches[1]}.json";
$opts = JSON_PRETTY_PRINT | JSON_INVALID_UTF8_SUBSTITUTE | JSON_UNESCAPED_UNICODE;
file_put_contents($file, json_encode($content, $opts));
}
}
echo "OK\n";
+
+// Move some theme-specific resources from resources/themes/ to public/themes/
+echo "Theme resources... ";
+
+if (!file_exists("{$rootDir}/public/themes")) {
+ mkdir("{$rootDir}/public/themes");
+}
+
+foreach (glob("{$rootDir}/resources/themes/*", GLOB_ONLYDIR) as $file) {
+ $path = explode('/', $file);
+ $theme = $path[count($path)-1];
+
+ if (!file_exists("{$rootDir}/public/themes/{$theme}")) {
+ mkdir("{$rootDir}/public/themes/{$theme}");
+ }
+
+ if (!file_exists("{$rootDir}/public/themes/{$theme}/images")) {
+ mkdir("{$rootDir}/public/themes/{$theme}/images");
+ }
+
+ foreach (glob("{$file}/images/*") as $file) {
+ $path = explode('/', $file);
+ $image = $path[count($path)-1];
+ copy($file, "{$rootDir}/public/themes/{$theme}/images/{$image}");
+ }
+}
+
+echo "OK\n";
diff --git a/src/webpack.mix.js b/src/webpack.mix.js
index 21c60aea..0b343e59 100644
--- a/src/webpack.mix.js
+++ b/src/webpack.mix.js
@@ -1,44 +1,37 @@
/*
|--------------------------------------------------------------------------
| Mix Asset Management
|--------------------------------------------------------------------------
|
| Mix provides a clean, fluent API for defining some Webpack build steps
| for your Laravel application. By default, we are compiling the Sass
| file for the application as well as bundling up all the JS files.
|
*/
const { spawn } = require('child_process');
-const fs = require('fs');
const glob = require('glob');
const mix = require('laravel-mix');
mix.webpackConfig({
resolve: {
alias: {
'jquery$': 'jquery/dist/jquery.slim.js',
}
}
})
mix.before(() => {
spawn('php', ['resources/build/before.php'], { stdio: 'inherit' })
})
mix.js('resources/js/user.js', 'public/js').vue()
.js('resources/js/admin.js', 'public/js').vue()
glob.sync('resources/themes/*/', {}).forEach(fromDir => {
const toDir = fromDir.replace('resources/themes/', 'public/themes/')
mix.sass(fromDir + 'app.scss', toDir)
.sass(fromDir + 'document.scss', toDir);
-
- fs.stat(fromDir + 'images', {}, (err, stats) => {
- if (stats) {
- mix.copyDirectory(fromDir + 'images', toDir + 'images')
- }
- })
})
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Mon, Feb 2, 5:26 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
426829
Default Alt Text
(3 KB)
Attached To
Mode
R2 kolab
Attached
Detach File
Event Timeline
Log In to Comment