alwaysblank / blade-generate Goto Github PK
View Code? Open in Web Editor NEWForces generation of Blade template cache files for Sage9.
Forces generation of Blade template cache files for Sage9.
Composer errors out while trying to install blade-generate with the supplied installation command,
# wp package install [email protected]:alwaysblank/blade-generate.git
# wp package install [email protected]:alwaysblank/blade-generate.git
Installing package alwaysblank/blade-generate (dev-master)
Updating /home/user/.wp-cli/packages/composer.json to require the package...
Registering [email protected]:alwaysblank/blade-generate.git as a VCS repository...
Using Composer to install the package...
---
Loading composer repositories with package information
Updating dependencies
Reverted composer.json.
WP-CLI ran out of memory. Please see https://bit.ly/wpclimem for further help.
This happened to me on my local macOS and Ubuntu environments, and also my remote Debian environment. The solutions listed at https://bit.ly/wpclimem all seem to deal with memory allocation, but none of them worked for me.
I also tried downloading the package and trying the different options the wp package install
command offers:
wp package install <name|git|path|zip>
None of those worked.
Finally, I tried installing it to WP-CLI "manually", by requiring the package in ~/.wp-cli/packages/composer.json
and adding the GitHub repo as a repository:
{
"require": {
"alwaysblank/blade-generate": "dev-master"
},
"repositories": {
"wp-cli": {
"type": "composer",
"url": "https://wp-cli.org/package-index/"
},
"alwaysblank/blade-generate": {
"type": "vcs",
"url": "https://github.com/alwaysblank/blade-generate.git"
},
},
Composer returned this lint error:
# composer install
Loading composer repositories with package information
Reading composer.json of alwaysblank/blade-generate (refactor-standards)
Skipped branch refactor-standards, "a2dd1ed3ab743fa933ca2dfaadc507fd665d20d2:composer.json" does not contain valid JSON
Parse error on line 10:
...mand.php" ] "" }, "requi
---------------------^
Expected one of: 'EOF', '}', ',', ']'
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
- Installing symfony/finder (v2.7.0): Downloading (100%)
- Installing alwaysblank/blade-generate (dev-master 876d495): Cloning 876d49514c from cache
Writing lock file
Generating autoload files
However, the package installed and seems to work okay, so I'm not sure if that error is related to the installation?
# wp blade compile
Finding files...
Compiling templates 100% [========================================] 0:00 / 0:00
Success: Templates rendered!
Finally, a funny story: I was trying to install this package because I was getting a white screen of death on certain pages after pushing new templates for them up to my staging server. After taking a detour to try all the above and get it working, I realized that the real reason the templates weren't rendering was because I forgot to save my work and had uploaded empty template files to the server. ๐คฃ
I'm trying to compile blade templates in Sage theme, but I got an error:
Finding files...
PHP Fatal error: Uncaught Error: Call to undefined function App\sage() in /home/vagrant/.wp-cli/packages/vendor/alwaysblank/blade-generate/command.php:92
Stack trace:
#0 [internal function]: BladeCommand->compile(Array, Array)
#1 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(89): call_user_func(Array, Array, Array)
#2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#3 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(425): call_user_func(Object(Closure), Array, Array)
#4 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(365): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(388): WP_CLI\Runner->run_command(Array, Array)
#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1113): WP_CLI\Runner->_run_command_and_exit()
#7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/Launc in /home/vagrant/.wp-cli/packages/vendor/alwaysblank/blade-generate/command.php on line 92
Fatal error: Uncaught Error: Call to undefined function App\sage() in /home/vagrant/.wp-cli/packages/vendor/alwaysblank/blade-generate/command.php:92
Stack trace:
#0 [internal function]: BladeCommand->compile(Array, Array)
#1 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/CommandFactory.php(89): call_user_func(Array, Array, Array)
#2 [internal function]: WP_CLI\Dispatcher\CommandFactory::WP_CLI\Dispatcher\{closure}(Array, Array)
#3 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Dispatcher/Subcommand.php(425): call_user_func(Object(Closure), Array, Array)
#4 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(365): WP_CLI\Dispatcher\Subcommand->invoke(Array, Array, Array)
#5 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(388): WP_CLI\Runner->run_command(Array, Array)
#6 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Runner.php(1113): WP_CLI\Runner->_run_command_and_exit()
#7 phar:///usr/local/bin/wp/vendor/wp-cli/wp-cli/php/WP_CLI/Bootstrap/Launc in /home/vagrant/.wp-cli/packages/vendor/alwaysblank/blade-generate/command.php on line 92
wp package install benspants/blade-cache-management
We're trying to use blade-generate, but we're getting this error
Error: You don't appear to have installed or activated Sage 9!
I then took a quick look in the package and it appears that you're looking for the App\sage
namespace\function.
We're using a heavily customized theme where we've overridden the default App
namespace,
which is fully supported in the Sage theme.
Even some packages like soberwp have added wordpress filters to allow users/themes to override the default namespace.
../vendor/soberwp/controller/controller.php:
10 function sage()
11 {
12 // Determine if project namespace has been changed
13 sage = apply_filters('sober/controller/sage/namespace', 'App') . '\sage';
14
15 // Return the function if it exists
16 if (function_exists($sage)) {
17 return $sage;
18 }
19
20 // Return false if function does not exist
21 return false;
22 }
../vendor/soberwp/controller/src/Loader.php:
60 protected function setNamespace()
61 {
62 $this->namespace =
63 (has_filter('sober/controller/namespace')
64 ? apply_filters('sober/controller/namespace', rtrim($this->namespace))
65 : 'App\Controllers');
66 }
Is it possible for you to make a similar solution with filters for this package?
I haven't personally worked with WP_CLI before so i don't know if you have full access to WordPress function or not, like apply_filters();
Not including any dev environments such as PHP version etc since this is more of a logical issue.
Currently this tool is hardcoded to use Sage 9's (current) path for blade templates, which is less than ideal (as evidenced by the fact that I've had to update it twice to modify that hardcoded path).
A better solution would be one (or both, or a combination) of the following:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.