Repository: lukeraymonddowning/MountainBreeze Branch: master Commit: 0f8ffed5c2df Files: 24 Total size: 18.3 KB Directory structure: gitextract_9_uh1z9a/ ├── .github/ │ ├── FUNDING.yml │ └── ISSUE_TEMPLATE/ │ ├── bug_report.md │ └── feature_request.md ├── .gitignore ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE ├── README.md ├── compiled/ │ └── .gitignore ├── composer.json ├── functions.php ├── index.php ├── mix-manifest.json ├── mountainbreeze/ │ ├── functions.php │ └── index.php ├── package.json ├── src/ │ └── scripts/ │ └── app.js ├── tailwind.config.js ├── templates/ │ ├── index.blade.php │ ├── layouts/ │ │ └── app.blade.php │ └── partials/ │ ├── footer.blade.php │ ├── header.blade.php │ └── the_loop.blade.php └── webpack.mix.js ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/FUNDING.yml ================================================ # These are supported funding model platforms github: [lukeraymonddowning] ================================================ FILE: .github/ISSUE_TEMPLATE/bug_report.md ================================================ --- name: Bug report about: Create a report to help us improve title: '' labels: '' assignees: '' --- **Describe the bug** A clear and concise description of what the bug is. **To Reproduce** Steps to reproduce the behavior: 1. Go to '...' 2. Click on '....' 3. Scroll down to '....' 4. See error **Expected behavior** A clear and concise description of what you expected to happen. **Screenshots** If applicable, add screenshots to help explain your problem. **Desktop (please complete the following information):** - OS: [e.g. iOS] - Browser [e.g. chrome, safari] - Version [e.g. 22] **Smartphone (please complete the following information):** - Device: [e.g. iPhone6] - OS: [e.g. iOS8.1] - Browser [e.g. stock browser, safari] - Version [e.g. 22] **Additional context** Add any other context about the problem here. ================================================ FILE: .github/ISSUE_TEMPLATE/feature_request.md ================================================ --- name: Feature request about: Suggest an idea for this project title: '' labels: '' assignees: '' --- **Is your feature request related to a problem? Please describe.** A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] **Describe the solution you'd like** A clear and concise description of what you want to happen. **Describe alternatives you've considered** A clear and concise description of any alternative solutions or features you've considered. **Additional context** Add any other context or screenshots about the feature request here. ================================================ FILE: .gitignore ================================================ /node_modules/ /vendor/ /dist/ /compiled/*.php style.css ================================================ FILE: CODE_OF_CONDUCT.md ================================================ # Contributor Covenant Code of Conduct ## Our Pledge In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, religion, or sexual identity and orientation. ## Our Standards Examples of behavior that contributes to creating a positive environment include: * Using welcoming and inclusive language * Being respectful of differing viewpoints and experiences * Gracefully accepting constructive criticism * Focusing on what is best for the community * Showing empathy towards other community members Examples of unacceptable behavior by participants include: * The use of sexualized language or imagery and unwelcome sexual attention or advances * Trolling, insulting/derogatory comments, and personal or political attacks * Public or private harassment * Publishing others' private information, such as a physical or electronic address, without explicit permission * Other conduct which could reasonably be considered inappropriate in a professional setting ## Our Responsibilities Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. ## Scope This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. ## Enforcement Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at lukeraymonddowning@gmail.com. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. ## Attribution This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html [homepage]: https://www.contributor-covenant.org For answers to common questions about this code of conduct, see https://www.contributor-covenant.org/faq ================================================ FILE: CONTRIBUTING.md ================================================ Pull requests are gladly accepted for bugs, improvements and features. Please explain why you think a certain feature needs adding, in as much detail as possible, using Github comments. This will make it much more likely for your code to make it into the repository. Thank you so much for all your hard work. People like you make Open Source awesomesauce. ================================================ FILE: LICENSE ================================================ MIT License Copyright (c) 2020 Luke Downing Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ================================================ FILE: README.md ================================================ # MountainBreeze A Wordpress theme template for the modern web developer. # Features - [Tailwind CSS](https://tailwindcss.com) baked in - [Alpine JS](https://github.com/alpinejs/alpine) baked in - [The Laravel Blade templating engine](https://laravel.com/docs/6.x/blade) - [Laravel Collections](https://laravel.com/docs/6.x/collections) - [Laravel Mix](https://laravel-mix.com) - jQuery removed by default # Getting started We've made Mountain Breeze super quick to get up and running, allowing you to start developing your theme in seconds. Requirements: - Composer - NPM From the `wp-content/themes` directory of your Wordpress development environment, run ```bash composer create-project lukeraymonddowning/mountain-breeze ``` If you want to do things manually, clone, fork or download the repository to your Wordpress 'wp-content/themes' directory. Then, from the theme directory, run ```$ composer install``` from the terminal or command prompt. The theme will automatically run ```$ npm install``` for you and even build the needed stylesheets for you. # Our motivation Wordpress powers over 1/3rd of the internet, which is just insane when you think about it. Whilst it is a powerful platform with a low barrier to entry, we also think it can be a messy platform, and parts of it are beginning to show their age. Especially when compared to a framework like Laravel, Wordpress can become a burden to develop in. But it doesn't have to be. In fact, with just a little tweaking, you can have the best of both worlds. This is our *opinionated* Wordpress theme setup. These opinions come from years of developing with Wordpress and Laravel, of using jQuery and Alpine, of using Bootstrap and Tailwind, and from seeing what made our lives as developers easier. We include libraries that we think truly add value, remove ones we feel don't, and give you the flexibility to make any adjustments you want. Our thanks goes to the many creators and contributors behind Laravel, Tailwind CSS, Alpine JS and all of their components for providing such an outstanding experience for web developers. Without them, none of this would be possible. Happy coding! # Building assets Mountain Breeze builds your style.css and js files using Laravel Mix. This allows you to use the latest Javascript features and advanced CSS. To build your assets for development, run ```$ npm run dev``` from the theme directory in the terminal. When you're ready for production, run ```$ npm run prod``` from the theme directory in the terminal. This will minify and prepare your files ready for go live. # Using Blade Mountain Breeze ships with Blade support baked in. Blade is a powerful templating engine provided in the Laravel framework, and developers love it for the power it offers whilst remaining easy and enjoyable to use. All blade files are stored in the theme's 'templates' directory. Mountain Breeze can automatically detect which wordpress template file it should use and, if a matching blade file exists, will use that instead. You don't even have to include the corresponding template file (eg: page.php) in the root directory. We have already done this for you for the index.php file, which you can find at 'templates/index.blade.php'. But it gets even better. The Wordpress Loop is one of the most common patterns in Wordpress development. To help with this, Mountain Breeze includes a custom blade directive: ```@loop```. This allows you to quickly implement the Wordpress loop in any template file. Here is an example: ```
@loop

{{ the_title(); }}

{{ the_excerpt(); }}

@endloop
``` Pretty awesome, huh? For more details on using blade, check out the documentation at https://laravel.com/docs/6.x/blade # Using Tailwind Tailwind is baked right into Mountain Breeze, and you can start using it right away. In fact, you can check out our example index file in 'templates/index.blade.php' to see it in use. If you would like to customise Tailwind, you can edit the included tailwind.config.js file. Available options can be found at https://tailwindcss.com/docs/configuration By default, we purge all `.blade.php` files in the `template` directory. If you have other files that include Tailwind classes, you need to add them to the purge array in the tailwind config file. # Using Alpine Alpine is baked right into Mountain Breeze, and you can start using it right away. In fact, you can check out our example index file in 'templates/index.blade.php' to see it in use. # Using Collections Laravel Collections provide an awesome wrapper around arrays, and provide many useful utilities to make developing easier. You can create a Collection by calling the ```collect(array $array)``` helper function. For more details on using collections, check out the documentation at https://laravel.com/docs/6.x/collections # Using Mix Laravel Mix is a webpack wrapper that take the complexity out of webpack. Especially for newer developers, webpack can be one of the biggest hurdles to development, but the power it offers cannot be taken lightly. Mix takes all the pain out of webpack, leaving you with the power you need. Our default mix configuration should suffice for most projects, but if you want to customise it further, check out the documentation at https://laravel-mix.com # No jQuery? jQuery has been and always will be close to our hearts. For years, it was the only real way to endure javascript development on the web. But the web has finally caught up, and the problems that once plagued it don't really exist anymore. Especially for simple Wordpress sites, jQuery is nothing more than an unnecessary burden that hogs resources and user bandwidth. We believe libraries like Alpine JS offer a much nicer syntax at a much lower cost, so we opted to remove jQuery by default in the theme. If you really can't do without it, you can get it back by pasting the following code in your functions.php file: ``` public function enablejQuery() { return true; } ``` ================================================ FILE: compiled/.gitignore ================================================ ================================================ FILE: composer.json ================================================ { "name": "lukeraymonddowning/mountain-breeze", "description": "A Wordpress theme implementing Tailwind CSS and Alpine JS, and removing jQuery once and for all.", "type": "library", "license": "MIT", "authors": [ { "name": "Luke Downing", "email": "lukeraymonddowning@gmail.com" } ], "require": { "illuminate/view": "^8.0", "illuminate/events": "^8.0", "illuminate/filesystem": "^8.0" }, "scripts": { "post-install-cmd": "npm install" } } ================================================ FILE: functions.php ================================================ component('partials.the_loop', 'loop'); }); add_action('wp_enqueue_scripts', function () { if (!function_exists('enablejQuery') || !enablejQuery()) { wp_deregister_script('jquery'); } wp_enqueue_style('style', get_stylesheet_uri()); wp_enqueue_script('app', get_stylesheet_directory_uri() . '/dist/app.js'); }); add_filter('template_include', function ($template) { $templateName = wp_basename(wp_basename($template, '.php'), '.blade'); if (getBladeViewFactory()->exists($templateName)) { $GLOBALS['template_name'] = $templateName; $template = __DIR__ . '/../mountainbreeze/index.php'; } return $template; }); collect([ 'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date', 'embed', 'home', 'frontpage', 'privacypolicy', 'page', 'paged', 'search', 'single', 'singular', 'attachment' ])->each(function($type) { add_filter("{$type}_template_hierarchy", function($templates) { return collect($templates)->map(function($template) { $filename = wp_basename($template, '.php'); return ["templates/$filename.blade.php", $template]; })->flatten() ->toArray(); }); }); function getBladeViewFactory() { $viewResolver = new EngineResolver; $viewResolver->register('blade', function () { return new CompilerEngine($GLOBALS['compiler']); }); $viewResolver->register('php', function () { return new PhpEngine; }); return new Factory( $viewResolver, new FileViewFinder($GLOBALS['filesystem'], getTemplateDirectory()), new Dispatcher() ); } function getTemplateDirectory() { return [__DIR__ . '/../templates/']; } function getCompiledTemplateDirectory() { return __DIR__ . '/../compiled/'; } ================================================ FILE: mountainbreeze/index.php ================================================ make($GLOBALS['template_name'], [ "data" => [1, 2, 3, 4] ])->render(); ================================================ FILE: package.json ================================================ { "name": "mountain-breeze", "version": "1.0.0", "description": "A Wordpress theme implementing Tailwind CSS and Alpine JS, and removing jQuery once and for all.", "main": "index.js", "scripts": { "development": "mix", "dev": "npm run development", "watch": "mix watch", "watch-poll": "mix watch -- --watch-options-poll=1000", "hot": "mix watch --hot", "production": "mix --production", "postinstall": "npm run dev" }, "repository": { "type": "git", "url": "git+https://github.com/lukeraymonddowning/MountainBreeze.git#mountainbreeze" }, "keywords": [ "wordpress", "php", "tailwindcss", "alpinejs", "jquery", "theme" ], "author": "Luke Raymond Downing", "license": "MIT", "bugs": { "url": "https://github.com/lukeraymonddowning/MountainBreeze/issues" }, "homepage": "https://github.com/lukeraymonddowning/MountainBreeze/tree/mountainbreeze#readme", "dependencies": { "alpinejs": "^2.0", "tailwindcss": "^2.0" }, "devDependencies": { "cross-env": "^7.0.0", "laravel-mix": "^6.0" } } ================================================ FILE: src/scripts/app.js ================================================ import 'alpinejs' ================================================ FILE: tailwind.config.js ================================================ module.exports = { purge: [ "./templates/**/*.blade.php" ], theme: { extend: {}, }, variants: {}, plugins: [], } ================================================ FILE: templates/index.blade.php ================================================ @extends('layouts.app') @section('content')

@endsection ================================================ FILE: templates/layouts/app.blade.php ================================================ @include('partials.header') @yield('content') @include('partials.footer') ================================================ FILE: templates/partials/footer.blade.php ================================================ @php(wp_footer()) ================================================ FILE: templates/partials/header.blade.php ================================================ @php(wp_head()) @php(wp_body_open()) ================================================ FILE: templates/partials/the_loop.blade.php ================================================ @if(have_posts()) @while(have_posts()) @php(the_post()) {{ $slot }} @endwhile @endif ================================================ FILE: webpack.mix.js ================================================ let mix = require("laravel-mix"); mix.js(`src/scripts/app.js`, "dist/") .postCss(`src/styles/style.css`, "./", [require("tailwindcss")]);