GithubHelp home page GithubHelp logo

mindkomm / theme-lib-mix Goto Github PK

View Code? Open in Web Editor NEW
35.0 35.0 8.0 11 KB

A Laravel Mix function for WordPress themes.

License: MIT License

PHP 100.00%
laravel-mix theme-development wordpress wordpress-theme

theme-lib-mix's People

Contributors

gchtr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

theme-lib-mix's Issues

Mix() can't find the mix-manifest.json for a Wordpress child theme

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_pathfirst 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?

globally/static config eg set default path?

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.