mindkomm / theme-lib-mix Goto Github PK
View Code? Open in Web Editor NEWA Laravel Mix function for WordPress themes.
License: MIT License
A Laravel Mix function for WordPress themes.
License: MIT License
Using mix()
on a custom theme with laravel mix works great. But noticed it won't find the manifest if the $manifest_directory is in the child-theme.
In line 24 get_theme_file_path
first checks get_stylesheet_directory
which returns the path to the parent theme before get_template_directory
which would be the child-theme.
Nobody should be modifying or adding anything to the parent theme and should compile all assets to the child, or would you recommend leaving the mix-manifest.json
outside the theme entirely and pass the $manifest_directory every time?
Hi,
it'd be useful to be able to globally set the path to something other than build
so it doesn't need to be called every time I call mix
I will probably be using it a lot in my templates, but my files are in dist
, so ideally I could configure this in my bootstrap functions
<script src="{{ mix('js/app.js') }}"></script>
<link rel="stylesheet" href="{{ mix('css/app.css')" />
also it would be good if you could namespace your class/methods to Mindkomm
maybe?
anyway in the meantime I've done it like this (adding the namespace to your file):
public function add_to_twig( $twig ) {
$twig->addFunction( new \Timber\Twig_Function( 'mix', [$this, 'mix']));
return $twig;
}
public function mix($path) {
return \Mindkomm\mix($path, ['manifest_directory' => 'dist']);
}
hope that's useful to somebody.
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.