Skip to content

robbinjohansson/sage-laravel-mix

Repository files navigation

sage-laravel-mix

Sage is a WordPress starter theme with a modern development workflow.

This is an extension of the Sage WordPress starter theme, all credit goes to the awesome work made by the guys over at roots. This repo was originally cloned from Sage official repo at 2017-11-01 and will continuously be updated according to changes made at the original theme is heavily outdated.

I have no plans on maintaining/updating this repo since I don't use wordpress anymore. See #6 if you want to contribute.

Different from Sage 9:

  • Laravel Mix as a wrapper for webpack
  • TailwindCSS
  • Vue.js
  • Prepared with WP Glide (Glide)

Installation

This readme assumes you are familiar with Sage and Bedrock structure for Wordpress. If not, head over to https://roots.io/ to learn more.

# @ bedrock/web/app/themes
$ git clone https://github.com/robbinfellow/sage-laravel-mix.git
$ cd sage-laravel-mix
$ composer install
$ yarn
$ yarn dev / production / watch

Laravel mix

Laravel Mix is preconfigured when cloning this theme. However it might be a good idea to review the full documentation on GitHub.

# Compile assets without minification
$ yarn dev

# Watch working assets
$ yarn watch

# Minify and compile assets for production
$ yarn production

WP Glide

Run the following from your bedrock root:

$ composer require frozzare/wp-glide

Use Glide to generate images:

@if(has_post_thumbnail())
    <img src="{{ App::glideImage() }}?w=1200&h=675&fit=crop&fm=pjpg&q=60">
@endif

Protip: Don't forget to activate the plugin after you install it.

Glide documentation

Disable WP Glide

Don't want to use WP Glide? No problem, skip the Glide installation step from above and remove the following lines from /app/filters.php:

add_filter('glide/options', function ($options) {
    $options['cache'] = WP_CONTENT_DIR . '/uploads/cache/glide';
    $options['max_image_size'] = 2000*2000;
    return $options;
});

Documentation

Credits

License

sage-laravel-mix is an open-sourced software licensed under the MIT license.