* Sage 10 (#2122)

There's a new version of Sage in the pipeline. The most significant change is the introduction of Acorn. I'll release more information about Acorn as it nears completion.

TODO

- [ ] Restructure templates (@retlehs)
- [ ] Code splitting (@austinpray, @QWp6t, @swalkinshaw)
- [ ] WooCommerce compatibility (@QWp6t, @retlehs)
- [ ] API for build process (possibly extend Laravel Mix) (@QWp6t, @austinpray)
- [ ] Acorn - https://github.com/QWp6t/acorn/issues/1 (@QWp6t)
- [ ] Documentation

Sage 10 and Acorn are both still works in progress so you should definitely not start any projects with them in their current state unless you're willing to do an inordinate amount of debugging and go through the hassle of keeping up with updates as we push them.

* Add wp_body_open hook (WP 5.2+)

* Add missing search blade
Enable preflight by default
Bump version to 10.0.0 in package.json and style.css
Change PHP requirement to 7.1.3
Upgrade roots/sage-installer
Remove deprecated qwp6t/acorn repository from composer.json
Add some sane optimizations to composer.json
Remove excessive linebreaks from helpers.php
Make config linebreaking uniform
Add missing space to ! conditionals to stay consistent with PSR-1/2
Update the file structure in README.md and add the new sponsor
Revert to shorthand @php()
Add aside markup to sidebar and wrap it in @hasSection
Add a document wrapper
Add ARIA roles to the document, main, aside, header, nav, and footer wrappers
Change entry-meta conditional in content-search.blade.php to an @includeWhen
Add some sane linebreaks throughout the views and codebase to increase readability
Add docblocks to the example Title.php composer

* Add WP Blade Check

* Remove redundant ARIA roles

* Revert language_attributes() to get_language_attributes()
Remove roots/wp-blade-check until we decide on where to put it
Only enable preflight when not in production

* Make searchform translations match WordPress core

* Update Travis conf

* rmdist is gone in Sage 10

* Change to Laravel Mix
Clean up and refactor starter styles
Remove autoload from styles/scripts
Remove $ import on customizer.js as Mix autoload will handle that
Fix conditional on comments.blade.php
Bump PHP version to 7.1.3 on Travis
Remove unnecessary fields in package.json as it will never be published
Rename main.css/main.js to app.css/app.js
Automatically remove Blade cache when theme is activated, changed, or removed

* Simplify Blade cache removal

* Use ->uri() on asset for sanity purposes

* Fix app.js typo

* Add npm-run-all

This lets us run related scripts together pretty easily since we can
use glob patterns (e.g. `lint:*` — `**` is supported too). You can
either run scripts sequentially with `run-s` or in parallel with
`run-p`.

See: https://github.com/mysticatea/npm-run-all

* Add -c (continue on error) flag to lint command

This way lint issues for the scripts doesn’t block the styles from being
linted.

* run-s all the things

* Break up `build:production`
* Refine `start` script to call `build` but using `--watch`
  * Since the base command is the same, this makes it easier to
    maintain.
* Use run-s for `test` script for consistency.

* Refactor build commands

The only thing that differs between `build` and `build:production` is
the Node environment variable. We can use `run-s build:mix` preceeded by
the correspinding environment setting.

* Fix start command

We need to pass `--watch` to the `build:mix` not `build`. Also, this
means we need to set the Node environment beforehand since `build:mix`
doesn’t have that.

* Fix hot command

`dist` needs to exist for HMR to work since it looks for `dist/hot`.
This means we should probably build once before starting HMR. This also
renames `build:mix` to just `mix` to keep a consistent naming scheme.

* Move cache location to `storage/`
Add app.name to configuration
Add a ServiceProvider stub
Add missing trailing commas to config
Remove automatic Blade cache removal action as it is no longer necessary
Clean up .gitignore
Clean up JavaScript docblocks
Remove home.js example
Remove leftover Sage 9 information from README

* Remove redundent $asset in setup.php

* Add clean:views npm script (#2176)

Since views are in a predictable location within the theme, this might
be handy. A side effect of adding this is that generated views are now
cleared on every production build, which might be a good thing. If not,
it’s not hard to change.

* [Sage 10] Add src and public mix path helpers (#2177)

Since Mix uses the `webpack.mix.js` path as the webpack context and
doesn’t let us change the context, having a helper can make it easier to
add new assets. It also provides a single source of truth for the assets
source directory.

Also, this adds a `public` function which just makes it easy for setting
the `to` path in the `copyDirectory` task.

By including the definitions of these functions within the
`webpack.mix.js` file itself it makes it clear to Sage users that they
are not a part of Mix.

* Typo [ci skip]

* Syntax optimizations

* Combine watch rules using extended glob patterns
* Use template literals for mix helpers (src + public). Makes it seem
  less cluttered.

* Use out instead of public for publicPath helper

`public` is a future reserved word in JS

* Use publicPath instead of out

* Use Roots\Acorn\ServiceProvider (#2180)

* Make editorconfig account for Blade's outside of resources/views

* non-Blade files located in resources/views should also be indent_size = 2

* [Sage 10] Replace jQuery’s .ready() (#2182)

* Use DOMContentLoaded listener for document ready
* Account for DOMContentLoaded not firing
* Extract ready() to utils.js

Also uses `window.setTimeout(fn, 0)` to cover async.

In a commit/PR in the near future, the `util` directory will be going
away since the DOM router has been extracted to its own package
(https://github.com/roots/js-dom-router). `utils.js` will function as a
place for custom utilities, similar to what `app/helpers.php` is on the
PHP side of things.

* Replace Travis CI with CircleCI (#2185)

* Replace Travis CI with CircleCI

* Replace badge [ci skip]

* Optimize CircleCI (#2186)

* Optimize CircleCI

* Change cache keys

* Update .gitattributes

* Update .gitattributes

* Optimize CircleCI config (#2188)

* Update composer dependencies

* Bump required WordPress version (#2193)

* Change WordPress requirement to 5.2

* Restructure (#2200)

* Restructure Sage
* Composer test -> lint

* Fix version_compare() operators (#2195)

* Simplify Mix Browsersync API (#2198)

* New DOM router + dynamic imports (#2190)

* Use new js-dom-router 
* add dynamic import support with example
* Use babel-eslint as eslint parser

* Update dependencies

* Add post-autoload-dump script for package discovery (#2201)

* CircleCI: `yarn install` with `--frozen-lockfile` (#2203)

* Bump babel-eslint from 10.0.1 to 10.0.2 (#2209)

Bumps [babel-eslint](https://github.com/babel/babel-eslint) from 10.0.1 to 10.0.2.
- [Release notes](https://github.com/babel/babel-eslint/releases)
- [Commits](https://github.com/babel/babel-eslint/compare/v10.0.1...v10.0.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump sass from 1.21.0 to 1.22.0 (#2211)

Bumps [sass](https://github.com/sass/dart-sass) from 1.21.0 to 1.22.0.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.21.0...1.22.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump eslint-plugin-import from 2.17.3 to 2.18.0 (#2210)

Bumps [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) from 2.17.3 to 2.18.0.
- [Release notes](https://github.com/benmosher/eslint-plugin-import/releases)
- [Changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md)
- [Commits](https://github.com/benmosher/eslint-plugin-import/compare/v2.17.3...v2.18.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump eslint from 5.16.0 to 6.0.1 (#2212)

Bumps [eslint](https://github.com/eslint/eslint) from 5.16.0 to 6.0.1.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v5.16.0...v6.0.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Fix npm run start script options not forwarded with npm (#2205)

This is a known difference between yarn and npm and will eventually
break with yarn once backwards compatibility is removed.

* Use WordPress’ Browserslist config (#2214)

Co-authored-by: Ben Word <ben@benword.com>

* Bump sass from 1.22.0 to 1.22.1 (#2216)

Bumps [sass](https://github.com/sass/dart-sass) from 1.22.0 to 1.22.1.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.22.0...1.22.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump sass from 1.22.1 to 1.22.3 (#2218)

Bumps [sass](https://github.com/sass/dart-sass) from 1.22.1 to 1.22.3.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.22.1...1.22.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump laravel-mix from 4.0.16 to 4.1.2 (#2219)

Bumps [laravel-mix](https://github.com/JeffreyWay/laravel-mix) from 4.0.16 to 4.1.2.
- [Release notes](https://github.com/JeffreyWay/laravel-mix/releases)
- [Commits](https://github.com/JeffreyWay/laravel-mix/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Update README [ci skip]

* [Security] Bump lodash from 4.17.11 to 4.17.14 (#2259)

Bumps [lodash](https://github.com/lodash/lodash) from 4.17.11 to 4.17.14. **This update includes security fixes.**
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.11...4.17.14)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump sass from 1.22.3 to 1.22.4 (#2260)

Bumps [sass](https://github.com/sass/dart-sass) from 1.22.3 to 1.22.4.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.22.3...1.22.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* chore(readme): Use brand color for Twitter follow badge

[ci skip]

* Acorn asset manager config (#2220)

* Add logs directory

* Bump sass from 1.22.4 to 1.22.5 (#2263)

Bumps [sass](https://github.com/sass/dart-sass) from 1.22.4 to 1.22.5.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.22.4...1.22.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Add alert component with view composer (#2267)

Resolves #2262

* Fix broken source maps + remove unnecessary conditionals (#2268)

Resolves #2266

Laravel Mix has a bug where source maps are not generated if you do not
specify the source map type (the second argument). This corrects that.

Co-authored-by: Matt Mirus <matt@mattmirus.com>

* chore(config): add alert component alias to view config (#2272)

This also updates Acorn.

* Bump sass from 1.22.5 to 1.22.7 (#2273)

Bumps [sass](https://github.com/sass/dart-sass) from 1.22.5 to 1.22.7.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.22.5...1.22.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump eslint-plugin-import from 2.18.0 to 2.18.2 (#2275)

Bumps [eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import) from 2.18.0 to 2.18.2.
- [Release notes](https://github.com/benmosher/eslint-plugin-import/releases)
- [Changelog](https://github.com/benmosher/eslint-plugin-import/blob/master/CHANGELOG.md)
- [Commits](https://github.com/benmosher/eslint-plugin-import/compare/v2.18.0...v2.18.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* No scripts/suggests during `composer install` on CircleCI [ci skip]

* Add timezone, globals, and locale app config [ci skip]

* Add logging config

* Update theme structure in README [ci skip]

* Move get_search_form and body_class to Acorn
comments_template() now defaults to `partials/comments.blade.php`
Composers are now autoloaded

* Bump sass from 1.22.7 to 1.22.9 (#2281)

Bumps [sass](https://github.com/sass/dart-sass) from 1.22.7 to 1.22.9.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.22.7...1.22.9)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump eslint from 6.0.1 to 6.1.0 (#2276)

Bumps [eslint](https://github.com/eslint/eslint) from 6.0.1 to 6.1.0.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v6.0.1...v6.1.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Update sponsors [ci skip]

* Keep a commented out example of calling a Composer class

* Bump dependencies
Add sage-svg (#2270)
Add sage-directives (#2265)
Start changelog (Related to #2271)

* Set `wp_nav_menu` echo to `false` (#2278)

* Bump @wordpress/browserslist-config from 2.5.0 to 2.6.0 (#2282)

Bumps [@wordpress/browserslist-config](https://github.com/WordPress/gutenberg/tree/HEAD/packages/browserslist-config) from 2.5.0 to 2.6.0.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/master/packages/browserslist-config/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/browserslist-config@2.6.0/packages/browserslist-config)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* chore(deps): log1x/sage-directives from 1.0.9 to 1.1.2 (#2286)

Bumps [log1x/sage-directives](https://github.com/Log1x/sage-directives) from 1.0.9 to 1.1.2.
- [Release notes](https://github.com/Log1x/sage-directives/releases)
- [Changelog](https://github.com/Log1x/sage-directives/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Log1x/sage-directives/compare/v1.0.9...v1.1.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump sass-loader from 7.1.0 to 7.2.0 (#2287)

Bumps [sass-loader](https://github.com/webpack-contrib/sass-loader) from 7.1.0 to 7.2.0.
- [Release notes](https://github.com/webpack-contrib/sass-loader/releases)
- [Changelog](https://github.com/webpack-contrib/sass-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/sass-loader/compare/v7.1.0...v7.2.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Remove unnecessary linebreak [ci skip]

* docs(changelog): Use lowercase for "webpack"

Keeps it consistent with [their brand](https://webpack.js.org/branding/#the-name).

[ci skip]

* Bump rimraf from 2.6.3 to 3.0.0 (#2289)

Bumps [rimraf](https://github.com/isaacs/rimraf) from 2.6.3 to 3.0.0.
- [Release notes](https://github.com/isaacs/rimraf/releases)
- [Commits](https://github.com/isaacs/rimraf/compare/v2.6.3...v3.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump sass from 1.22.9 to 1.22.10 (#2292)

Bumps [sass](https://github.com/sass/dart-sass) from 1.22.9 to 1.22.10.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.22.9...1.22.10)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump sass-loader from 7.2.0 to 7.3.1 (#2293)

Bumps [sass-loader](https://github.com/webpack-contrib/sass-loader) from 7.2.0 to 7.3.1.
- [Release notes](https://github.com/webpack-contrib/sass-loader/releases)
- [Changelog](https://github.com/webpack-contrib/sass-loader/blob/master/CHANGELOG.md)
- [Commits](https://github.com/webpack-contrib/sass-loader/compare/v7.2.0...v7.3.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump eslint from 6.1.0 to 6.2.1 (#2294)

Bumps [eslint](https://github.com/eslint/eslint) from 6.1.0 to 6.2.1.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v6.1.0...v6.2.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump babel-eslint from 10.0.2 to 10.0.3 (#2295)

Bumps [babel-eslint](https://github.com/babel/babel-eslint) from 10.0.2 to 10.0.3.
- [Release notes](https://github.com/babel/babel-eslint/releases)
- [Commits](https://github.com/babel/babel-eslint/compare/v10.0.2...v10.0.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump eslint from 6.2.1 to 6.2.2 (#2296)

Bumps [eslint](https://github.com/eslint/eslint) from 6.2.1 to 6.2.2.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v6.2.1...v6.2.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump log1x/sage-directives from 1.1.2 to 1.1.3 (#2297)

Bumps [log1x/sage-directives](https://github.com/Log1x/sage-directives) from 1.1.2 to 1.1.3.
- [Release notes](https://github.com/Log1x/sage-directives/releases)
- [Changelog](https://github.com/Log1x/sage-directives/blob/master/CHANGELOG.md)
- [Commits](https://github.com/Log1x/sage-directives/compare/v1.1.2...v1.1.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Adds i18n support (#2290)

Adds translation commands to package.json. Includes support for Javascript strings.

Adds translator comment to example app/Composers/Title.php.

Does not implement the loading of translated strings as this is a costly operation and implementations can be opinionated.

* Update Composers to work with the latest Acorn
- Bump dependencies
- Run all translate commands with translate:*

* Use $this->data in the Alert Composer (#2300)

* Use $this->data for handling data in the example Alert composer
* Bump Acorn

* Update sponsors [ci skip]

* Update sponsors [ci skip]

* Update sponsors [ci skip]

* Call ->render() on view instead of relying on toString (#2330)

* Bump for Acorn (#2337)

* Breaking Change: Bump required PHP version to 7.2
* chore(deps): Bump dependencies
* fix(app): Change app.env and app.debug default values (important*)
* chore(deps-dev): Add filp/whoops to required-dev
* chore(ci): Remove php-71 from CircleCI

* Use mix-manifest.json (Fixes #2329)

* Pre-Sage 10 Alpha (#2338)

- Refactor default styles and scripts
- Clean up default view markup
- Change `Title.php` to `Post.php` to suggest a more organized workflow (Supersedes #2320)
- Create an `App` composer to show an example of a global variable
- Add `align-wide` and `responsive-embeds` to `add_theme_support` by default
- Remove deprecated `soil-jquery-cdn` from `add_theme_support`
- Clean up docblocks project-wide
- Update linting to match the latest PSR-12 standards (e.g. the license docblocks)
- Add an appropriate `#app` wrapper to make the project ready for frameworks like Vue
- Add `laravel-mix-purgecss` for purgeCSS in production
- Add `laravel-mix-copy-watched` for asset watching & versioning
- Add `laravel-mix-wp-blocks` to handle compiling blocks
- Reduce the footprint of the default `webpack.mix.js`
- Append filetypes to asset names
- Add default block editor assets
- Add handling for the WordPress asset manifest
- Remove visual editor styling (Fixes #2269)
- Add sensible default styles and folders
- Remove unused `phpcs.xml`
- Move `sage-directives` and `sage-svg` to suggests
- Bump dependencies
- Add Brandon Nifong as an author
- Change license URI to https
- Remove unused function namespaces from setup.php
- Append filetypes to asset names
- Add default block editor assets
- Add handling for the WordPress asset manifest
- Ignore dist when running phpcs
- Change the search input class the the WP default

* Inline manifest.js when enqueueing editor.js (#2344)

* Add theme color palette support (#2352)

* Bump bootstrap from 4.3.1 to 4.4.1 (#2350)

Bumps [bootstrap](https://github.com/twbs/bootstrap) from 4.3.1 to 4.4.1.
- [Release notes](https://github.com/twbs/bootstrap/releases)
- [Commits](https://github.com/twbs/bootstrap/compare/v4.3.1...v4.4.1)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump eslint from 6.6.0 to 6.7.2 (#2354)

Bumps [eslint](https://github.com/eslint/eslint) from 6.6.0 to 6.7.2.
- [Release notes](https://github.com/eslint/eslint/releases)
- [Changelog](https://github.com/eslint/eslint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/eslint/eslint/compare/v6.6.0...v6.7.2)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump sass from 1.23.3 to 1.23.7 (#2345)

Bumps [sass](https://github.com/sass/dart-sass) from 1.23.3 to 1.23.7.
- [Release notes](https://github.com/sass/dart-sass/releases)
- [Changelog](https://github.com/sass/dart-sass/blob/master/CHANGELOG.md)
- [Commits](https://github.com/sass/dart-sass/compare/1.23.3...1.23.7)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Sage 10 editor scripts & styles (#2351)

* adds alternate button style and super basic starter css

* Adds transition variable

* Add bootstrap max-width to editor-styles

* updates button scss, editor wrapper scss, and registration

* rename is-style-ghost to is-style-outline

* simplify structure and cleanup css

* Protect Ben Word's typographic holdings

* Remove scoping from .has-xyz-color classes

* Restore scss partial import structure

* rename partials, move color util, apply bootstrap font

* alphabetical selectors ¯\_(ツ)_/¯

* Bump stylelint from 11.1.1 to 12.0.0 (#2342)

Bumps [stylelint](https://github.com/stylelint/stylelint) from 11.1.1 to 12.0.0.
- [Release notes](https://github.com/stylelint/stylelint/releases)
- [Changelog](https://github.com/stylelint/stylelint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stylelint/stylelint/compare/11.1.1...12.0.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* Bump squizlabs/php_codesniffer from 3.5.2 to 3.5.3 (#2356)

Bumps [squizlabs/php_codesniffer](https://github.com/squizlabs/PHP_CodeSniffer) from 3.5.2 to 3.5.3.
- [Release notes](https://github.com/squizlabs/PHP_CodeSniffer/releases)
- [Commits](https://github.com/squizlabs/PHP_CodeSniffer/compare/3.5.2...3.5.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* README updates for 10.0.0-alpha.1 (#2271)

* Update theme structure + files in README

* Update setup.php

* Keep hierarchical assets directory structure (#2372)

* fix(stylelint): Fix broken tests (#2375)

feat(stylelint): Set `at-rule-empty-line-before` to `null` to allow sane seperation of imports

* chore(deps): Bump dependencies (#2376)

* update laravel-mix-wp-blocks (#2381)

* Update sponsors [ci skip]

* Sage 10 fixes/cleanup (#2413)

* fix(templates): Move the document wrapper from app.blade.php to index.php to fix hook run sequence (See: #2123)
* feat(mix): Add purgecss-with-wordpress whitelists by default
* chore(docblocks): Remove copyright/license from PHP docblocks
* chore(babel): Remove unused dynamic import plugin until Webpack 5
* chore(babel): Remove unused .babelrc
* chore(deps): Bump dependencies

* Laravel 7.x (#2429)

* enhance(acorn): Update to Laravel 7.x
* enhance(blade): Convert existing alert component to a new View Component
* chore(deps): Bump minimum PHP version to 7.2.5
* chore(deps): Bump dependencies
* chore(configs): Clean up configs
* BREAKING(config): Bump configs to support Laravel 7.x
* BREAKING(components): @Alert() has been replaced with <x-alert ...>
* BREAKING(composers): View co

* enhance(deps): Add `Requires PHP` and `Requires at least` to theme style headers. Bump WordPress requirement to v5.4 (#2409)

* Sage 10 Chores (#2431)

* enhance(functions): Make functions.php pretty
* fix(component): Fix improper use of translation on the Alert component
* enhance(component): Add `$slot` fallback ternary to the Alert component view
* chore(component): Move Alert component message to a slot by default to properly pass the translated string.
* chore(component): Properly set default values for Alert
* chore(deps): Bump dependencies
* chore(theme): Fix required PHP version in style.css

* Bump roots/acorn from 1.0.2 to 1.0.3 (#2433)

Bumps [roots/acorn](https://github.com/roots/acorn) from 1.0.2 to 1.0.3.
- [Release notes](https://github.com/roots/acorn/releases)
- [Commits](https://github.com/roots/acorn/compare/v1.0.2...v1.0.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump roots/acorn from 1.0.3 to 1.0.4 (#2440)

Bumps [roots/acorn](https://github.com/roots/acorn) from 1.0.3 to 1.0.4.
- [Release notes](https://github.com/roots/acorn/releases)
- [Commits](https://github.com/roots/acorn/compare/v1.0.3...v1.0.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump stylelint from 13.2.1 to 13.3.0 (#2439)

Bumps [stylelint](https://github.com/stylelint/stylelint) from 13.2.1 to 13.3.0.
- [Release notes](https://github.com/stylelint/stylelint/releases)
- [Changelog](https://github.com/stylelint/stylelint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stylelint/stylelint/compare/13.2.1...13.3.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Update sponsors [ci skip]

* Bump roots/acorn from 1.0.4 to 1.0.6 (#2444)

Bumps [roots/acorn](https://github.com/roots/acorn) from 1.0.4 to 1.0.6.
- [Release notes](https://github.com/roots/acorn/releases)
- [Commits](https://github.com/roots/acorn/compare/v1.0.4...v1.0.6)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump @wordpress/dependency-extraction-webpack-plugin from 2.4.0 to 2.5.0 (#2448)

Bumps [@wordpress/dependency-extraction-webpack-plugin](https://github.com/WordPress/gutenberg/tree/HEAD/packages/dependency-extraction-webpack-plugin) from 2.4.0 to 2.5.0.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/master/packages/dependency-extraction-webpack-plugin/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/dependency-extraction-webpack-plugin@2.5.0/packages/dependency-extraction-webpack-plugin)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump @wordpress/babel-preset-default from 4.11.0 to 4.12.1 (#2450)

Bumps [@wordpress/babel-preset-default](https://github.com/WordPress/gutenberg/tree/HEAD/packages/babel-preset-default) from 4.11.0 to 4.12.1.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/master/changelog.txt)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/babel-preset-default@4.12.1/packages/babel-preset-default)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump squizlabs/php_codesniffer from 3.5.4 to 3.5.5 (#2451)

Bumps [squizlabs/php_codesniffer](https://github.com/squizlabs/PHP_CodeSniffer) from 3.5.4 to 3.5.5.
- [Release notes](https://github.com/squizlabs/PHP_CodeSniffer/releases)
- [Commits](https://github.com/squizlabs/PHP_CodeSniffer/compare/3.5.4...3.5.5)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump laravel-mix-copy-watched from 2.2.3 to 2.2.4 (#2452)

Bumps [laravel-mix-copy-watched](https://github.com/dsktschy/laravel-mix-copy-watched) from 2.2.3 to 2.2.4.
- [Release notes](https://github.com/dsktschy/laravel-mix-copy-watched/releases)
- [Commits](https://github.com/dsktschy/laravel-mix-copy-watched/compare/v2.2.3...v2.2.4)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump jquery from 3.4.1 to 3.5.0 (#2445)

Bumps [jquery](https://github.com/jquery/jquery) from 3.4.1 to 3.5.0.
- [Release notes](https://github.com/jquery/jquery/releases)
- [Commits](https://github.com/jquery/jquery/compare/3.4.1...3.5.0)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Bump stylelint from 13.3.0 to 13.3.3 (#2453)

Bumps [stylelint](https://github.com/stylelint/stylelint) from 13.3.0 to 13.3.3.
- [Release notes](https://github.com/stylelint/stylelint/releases)
- [Changelog](https://github.com/stylelint/stylelint/blob/master/CHANGELOG.md)
- [Commits](https://github.com/stylelint/stylelint/compare/13.3.0...13.3.3)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>

* Update README.md

Co-authored-by: Ben Word <ben@benword.com>
Co-authored-by: Brandon Nifong <brandon@tendency.me>
Co-authored-by: Nathan Knowler <nathan@knowler.me>
Co-authored-by: Tang Rufus <tangrufus@gmail.com>
Co-authored-by: dependabot-preview[bot] <dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: Oskar Schöldström <m@oxy.fi>
Co-authored-by: Matt Mirus <matt@mattmirus.com>
Co-authored-by: Kelly Mears <developers@tinypixel.dev>
This commit is contained in:
QWp6t
2020-05-10 15:22:44 -07:00
committed by GitHub
parent d2d5df8295
commit 2c5479995d
107 changed files with 7267 additions and 26187 deletions

60
.circleci/config.yml Normal file
View File

@@ -0,0 +1,60 @@
version: 2.1
orbs:
sage:
executors:
node-10:
docker:
- image: 'circleci/node:10-stretch'
php-73:
docker:
- image: 'circleci/php:7.3-stretch'
php-72:
docker:
- image: 'circleci/php:7.2-stretch'
jobs:
build-php:
parameters:
executor:
type: executor
executor: << parameters.executor >>
steps:
- run: php -v
- checkout
- restore_cache:
keys:
- composer-v1-{{ checksum "composer.lock" }}
- composer-v1-
- run: composer install -n --prefer-dist --no-scripts --no-suggest
- run: composer lint
- save_cache:
key: composer-v1-{{ checksum "composer.lock" }}
paths:
- vendor
build-node:
executor: node-10
steps:
- run: yarn versions
- checkout
- restore_cache:
keys:
- node-v1-{{ checksum "yarn.lock" }}
- node-v1-
- run: yarn install --frozen-lockfile
- run: yarn run test
- run: yarn run build:production
- save_cache:
key: node-v1-{{ checksum "yarn.lock" }}
paths:
- node_modules
workflows:
build:
jobs:
- sage/build-node
- sage/build-php:
name: build-php-73
executor: sage/php-73
- sage/build-php:
name: build-php-72
executor: sage/php-72

View File

@@ -1,17 +1,24 @@
# editorconfig.org
root = true root = true
[*] [*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = space indent_style = space
indent_size = 2 indent_size = 2
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true trim_trailing_whitespace = true
insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
[*.php] [*.php]
indent_size = 4 indent_size = 4
[*.blade.php]
indent_size = 2
[resources/views/**.php] [resources/views/**.php]
indent_size = 2 indent_size = 2
[index.php]
indent_size = 2

View File

@@ -1,48 +1,42 @@
module.exports = { module.exports = {
'root': true, root: true,
'extends': 'eslint:recommended', extends: 'eslint:recommended',
'globals': { parser: 'babel-eslint',
'wp': true, globals: {
wp: true
}, },
'env': { env: {
'node': true, node: true,
'es6': true, es6: true,
'amd': true, amd: true,
'browser': true, browser: true,
'jquery': true, jquery: true
}, },
'parserOptions': { parserOptions: {
'ecmaFeatures': { ecmaFeatures: {
'globalReturn': true, globalReturn: true,
'generators': false, generators: false,
'objectLiteralDuplicateProperties': false, objectLiteralDuplicateProperties: false
'experimentalObjectRestSpread': true,
}, },
'ecmaVersion': 2017, ecmaVersion: 2017,
'sourceType': 'module', sourceType: 'module'
}, },
'plugins': [ plugins: ['import'],
'import', settings: {
],
'settings': {
'import/core-modules': [], 'import/core-modules': [],
'import/ignore': [ 'import/ignore': ['node_modules', '\\.(coffee|scss|css|less|hbs|svg|json)$']
'node_modules',
'\\.(coffee|scss|css|less|hbs|svg|json)$',
],
}, },
'rules': { rules: {
'no-console': 0, 'no-console': 0,
'quotes': ['error', 'single'],
'comma-dangle': [ 'comma-dangle': [
'error', 'error',
{ {
'arrays': 'always-multiline', arrays: 'always-multiline',
'objects': 'always-multiline', objects: 'always-multiline',
'imports': 'always-multiline', imports: 'always-multiline',
'exports': 'always-multiline', exports: 'always-multiline',
'functions': 'ignore', functions: 'ignore'
}, }
], ]
}, }
}; };

3
.gitattributes vendored
View File

@@ -1,3 +1,2 @@
/.github export-ignore /.circleci export-ignore
/.gitattributes export-ignore /.gitattributes export-ignore
/.travis.yml export-ignore

10
.gitignore vendored
View File

@@ -1,9 +1,5 @@
# Include your project-specific ignores in this file /node_modules
# Read about how to use .gitignore: https://help.github.com/articles/ignoring-files /vendor
.cache-loader /dist
dist
node_modules
npm-debug.log npm-debug.log
yarn-error.log yarn-error.log
/vendor
resources/assets/config-local.json

37
.stylelintrc Normal file
View File

@@ -0,0 +1,37 @@
{
"extends": "stylelint-config-standard",
"rules": {
"declaration-colon-newline-after": null,
"value-list-comma-newline-after": null,
"no-empty-source": null,
"no-descending-specificity": null,
"at-rule-empty-line-before": null,
"at-rule-no-unknown": [
true,
{
"ignoreAtRules": [
"extend",
"at-root",
"debug",
"warn",
"error",
"if",
"else",
"for",
"each",
"while",
"mixin",
"include",
"content",
"return",
"tailwind",
"apply",
"responsive",
"variants",
"screen",
"function"
]
}
]
}
}

View File

@@ -1,34 +0,0 @@
module.exports = {
'extends': 'stylelint-config-standard',
'rules': {
'no-empty-source': null,
'string-quotes': 'double',
'at-rule-no-unknown': [
true,
{
'ignoreAtRules': [
'extend',
'at-root',
'debug',
'warn',
'error',
'if',
'else',
'for',
'each',
'while',
'mixin',
'include',
'content',
'return',
'function',
'tailwind',
'apply',
'responsive',
'variants',
'screen',
],
},
],
},
};

View File

@@ -1,41 +0,0 @@
language: php
sudo: false
dist: trusty
php:
- 7.3
- 7.2
- 7.1
- nightly
env:
- TRAVIS_NODE_VERSION="8"
- TRAVIS_NODE_VERSION="10"
matrix:
fast_finish: true
allow_failures:
- php: nightly
cache:
apt: true
directories:
- $HOME/.composer/cache
- $HOME/.yarn-cache
- vendor
before_install:
- composer self-update
- source ~/.nvm/nvm.sh && nvm install $TRAVIS_NODE_VERSION && nvm use $TRAVIS_NODE_VERSION
- export PATH=$HOME/.yarn/bin:$PATH && travis_retry curl -o- -L https://yarnpkg.com/install.sh | bash
install:
- node -v && yarn -V
- travis_retry yarn
- composer install -o --prefer-dist --no-interaction
script:
- yarn run test
- yarn run build
- yarn run rmdist
- yarn run "build:production"
- composer test

View File

@@ -1,3 +1,16 @@
### 10.0.0-alpha.1: TBA
* Change PHP requirement to 7.2.
* Change WordPress requirement to 5.2.
* Move from `sage-lib` to [`Acorn`](https://github.com/roots/acorn) ([#2122](https://github.com/roots/sage/pull/2122))
* Change to [Laravel Mix](https://github.com/JeffreyWay/laravel-mix) for handling webpack and compiling/concatnating assets ([#2172](https://github.com/roots/sage/pull/2172))
* Sage now ships with Blade Composers which are native, robust, more powerful solution to "Controllers" from Sage 9
* Clean up starter Blade views
* Move mandatory filters such as the template include, body class, comments template, search form, etc. to Acorn
* Move core theme files back to the theme root (`index.php`, `functions.php`, etc.) to allow better child theme compatability
* Create a default `storage/` directory for cache, logs, etc.
* Update config files to reflect Acorn
* To be continued...
### 9.0.9: February 13th, 2019 ### 9.0.9: February 13th, 2019
* Update to Bootstrap 4.3.1 ([#2153](https://github.com/roots/sage/pull/2153)) * Update to Bootstrap 4.3.1 ([#2153](https://github.com/roots/sage/pull/2153))

View File

@@ -1,4 +1,4 @@
Copyright (c) Ben Word and Scott Walkinshaw Copyright © Roots
Permission is hereby granted, free of charge, to any person obtaining a copy of 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 this software and associated documentation files (the "Software"), to deal in

View File

@@ -1,19 +1,22 @@
# [Sage](https://roots.io/sage/) # [Sage](https://roots.io/sage/)
[![Packagist](https://img.shields.io/packagist/vpre/roots/sage.svg?style=flat-square)](https://packagist.org/packages/roots/sage) [![Packagist](https://img.shields.io/packagist/vpre/roots/sage.svg?style=flat-square)](https://packagist.org/packages/roots/sage)
[![devDependency Status](https://img.shields.io/david/dev/roots/sage.svg?style=flat-square)](https://david-dm.org/roots/sage#info=devDependencies) [![devDependency Status](https://img.shields.io/david/dev/roots/sage.svg?style=flat-square)](https://david-dm.org/roots/sage#info=devDependencies)
[![Build Status](https://img.shields.io/travis/roots/sage.svg?style=flat-square)](https://travis-ci.org/roots/sage) [![Build Status](https://img.shields.io/circleci/project/github/roots/sage/10.0.0-dev.svg?style=flat-square)](https://circleci.com/gh/roots/sage)
[![Follow Roots](https://img.shields.io/twitter/follow/rootswp.svg?style=flat-square&color=1da1f2)](https://twitter.com/rootswp)
Sage is a WordPress starter theme with a modern development workflow. Sage is a WordPress starter theme with a modern development workflow.
**Sage 10 is in active development and is currently in alpha. The `master` branch tracks Sage 10 development. If you want a stable version, use the [latest Sage 9 release](https://github.com/roots/sage/releases/latest).**
## Features ## Features
* Sass for stylesheets * Sass for stylesheets
* Modern JavaScript * Modern JavaScript
* [Webpack](https://webpack.github.io/) for compiling assets, optimizing images, and concatenating and minifying files * [Laravel Mix](https://github.com/JeffreyWay/laravel-mix) for compiling assets and concatenating and minifying files
* [Browsersync](http://www.browsersync.io/) for synchronized browser testing * [Browsersync](http://www.browsersync.io/) for synchronized browser testing
* [Blade](https://laravel.com/docs/5.6/blade) as a templating engine * [Blade](https://laravel.com/docs/5.8/blade) as a templating engine
* [Controller](https://github.com/soberwp/controller) for passing data to Blade templates * [Bootstrap 4](https://getbootstrap.com/) (optional)
* CSS framework (optional): [Bootstrap 4](https://getbootstrap.com/), [Bulma](https://bulma.io/), [Foundation](https://foundation.zurb.com/), [Tachyons](http://tachyons.io/), [Tailwind](https://tailwindcss.com/)
See a working example at [roots-example-project.com](https://roots-example-project.com/). See a working example at [roots-example-project.com](https://roots-example-project.com/).
@@ -21,8 +24,8 @@ See a working example at [roots-example-project.com](https://roots-example-proje
Make sure all dependencies have been installed before moving on: Make sure all dependencies have been installed before moving on:
* [WordPress](https://wordpress.org/) >= 4.7 * [WordPress](https://wordpress.org/) >= 5.4
* [PHP](https://secure.php.net/manual/en/install.php) >= 7.1.3 (with [`php-mbstring`](https://secure.php.net/manual/en/book.mbstring.php) enabled) * [PHP](https://secure.php.net/manual/en/install.php) >= 7.2.0 (with [`php-mbstring`](https://secure.php.net/manual/en/book.mbstring.php) enabled)
* [Composer](https://getcomposer.org/download/) * [Composer](https://getcomposer.org/download/)
* [Node.js](http://nodejs.org/) >= 8.0.0 * [Node.js](http://nodejs.org/) >= 8.0.0
* [Yarn](https://yarnpkg.com/en/docs/install) * [Yarn](https://yarnpkg.com/en/docs/install)
@@ -31,7 +34,7 @@ Make sure all dependencies have been installed before moving on:
Install Sage using Composer from your WordPress themes directory (replace `your-theme-name` below with the name of your theme): Install Sage using Composer from your WordPress themes directory (replace `your-theme-name` below with the name of your theme):
```shell ```sh
# @ app/themes/ or wp-content/themes/ # @ app/themes/ or wp-content/themes/
$ composer create-project roots/sage your-theme-name $ composer create-project roots/sage your-theme-name
``` ```
@@ -46,35 +49,42 @@ During theme installation you will have options to update `style.css` theme head
## Theme structure ## Theme structure
```shell ```sh
themes/your-theme-name/ # → Root of your Sage based theme themes/your-theme-name/ # → Root of your Sage based theme
├── app/ # → Theme PHP ├── app/ # → Theme PHP
│ ├── Controllers/ # → Controller files │ ├── Composers/ # → View composers
│ ├── Providers/ # → Service providers
│ ├── admin.php # → Theme customizer setup │ ├── admin.php # → Theme customizer setup
│ ├── filters.php # → Theme filters │ ├── filters.php # → Theme filters
│ ├── helpers.php # → Helper functions │ ├── helpers.php # → Helper functions
│ └── setup.php # → Theme setup │ └── setup.php # → Theme setup
├── config/ # → Config files
│ ├── app.php # → Application configuration
│ ├── assets.php # → Asset configuration
│ ├── filesystems.php # → Filesystems configuration
│ └── view.php # → View configuration
├── composer.json # → Autoloading for `app/` files ├── composer.json # → Autoloading for `app/` files
├── composer.lock # → Composer lock file (never edit) ├── composer.lock # → Composer lock file (never edit)
├── dist/ # → Built theme assets (never edit) ├── dist/ # → Built theme assets (never edit)
├── functions.php # → Composer autoloader, Acorn bootloader
├── index.php # → Never manually edit
├── node_modules/ # → Node.js packages (never edit) ├── node_modules/ # → Node.js packages (never edit)
├── package.json # → Node.js dependencies and scripts ├── package.json # → Node.js dependencies and scripts
├── resources/ # → Theme assets and templates ├── resources/ # → Theme assets and templates
│ ├── assets/ # → Front-end assets │ ├── assets/ # → Front-end assets
│ │ ├── config.json # → Settings for compiled assets
│ │ ├── build/ # → Webpack and ESLint config
│ │ ├── fonts/ # → Theme fonts │ │ ├── fonts/ # → Theme fonts
│ │ ├── images/ # → Theme images │ │ ├── images/ # → Theme images
│ │ ├── scripts/ # → Theme JS │ │ ├── scripts/ # → Theme JS
│ │ └── styles/ # → Theme stylesheets │ │ └── styles/ # → Theme stylesheets
│ ├── functions.php # → Composer autoloader, theme includes
│ ├── index.php # → Never manually edit
│ ├── screenshot.png # → Theme screenshot for WP admin
│ ├── style.css # → Theme meta information
│ └── views/ # → Theme templates │ └── views/ # → Theme templates
│ ├── components/ # → Component templates
│ ├── layouts/ # → Base templates │ ├── layouts/ # → Base templates
│ └── partials/ # → Partial templates │ └── partials/ # → Partial templates
── vendor/ # → Composer packages (never edit) ── screenshot.png # → Theme screenshot for WP admin
├── storage/ # → Storage location for cache (never edit)
├── style.css # → Theme meta information
├── vendor/ # → Composer packages (never edit)
└── webpack.mix.js # → Laravel Mix configuration
``` ```
## Theme setup ## Theme setup
@@ -84,9 +94,7 @@ Edit `app/setup.php` to enable or disable theme features, setup navigation menus
## Theme development ## Theme development
* Run `yarn` from the theme directory to install dependencies * Run `yarn` from the theme directory to install dependencies
* Update `resources/assets/config.json` settings: * Update `webpack.mix.js` with your local dev URL
* `devUrl` should reflect your local development hostname
* `publicPath` should reflect your WordPress folder structure (`/wp-content/themes/sage` for non-[Bedrock](https://roots.io/bedrock/) installs)
### Build commands ### Build commands
@@ -97,7 +105,6 @@ Edit `app/setup.php` to enable or disable theme features, setup navigation menus
## Documentation ## Documentation
* [Sage documentation](https://roots.io/sage/docs/) * [Sage documentation](https://roots.io/sage/docs/)
* [Controller documentation](https://github.com/soberwp/controller#usage)
## Contributing ## Contributing

View File

@@ -1,33 +0,0 @@
<?php
namespace App\Controllers;
use Sober\Controller\Controller;
class App extends Controller
{
public function siteName()
{
return get_bloginfo('name');
}
public static function title()
{
if (is_home()) {
if ($home = get_option('page_for_posts', true)) {
return get_the_title($home);
}
return __('Latest Posts', 'sage');
}
if (is_archive()) {
return get_the_archive_title();
}
if (is_search()) {
return sprintf(__('Search Results for %s', 'sage'), get_search_query());
}
if (is_404()) {
return __('Not Found', 'sage');
}
return get_the_title();
}
}

View File

@@ -1,10 +0,0 @@
<?php
namespace App\Controllers;
use Sober\Controller\Controller;
class FrontPage extends Controller
{
}

View File

@@ -0,0 +1,28 @@
<?php
namespace App\Providers;
use Roots\Acorn\ServiceProvider;
class ThemeServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
}

View File

@@ -0,0 +1,45 @@
<?php
namespace App\View\Components;
use Roots\Acorn\View\Component;
class Alert extends Component
{
/**
* The alert type.
*
* @var string
*/
public $type;
/**
* The alert message.
*
* @var string
*/
public $message;
/**
* Create the component instance.
*
* @param string $type
* @param string $message
* @return void
*/
public function __construct($type = 'primary', $message = null)
{
$this->type = $type;
$this->message = $message;
}
/**
* Get the view / contents that represent the component.
*
* @return \Illuminate\View\View|string
*/
public function render()
{
return $this->view('components.alert');
}
}

View File

@@ -0,0 +1,39 @@
<?php
namespace App\View\Composers;
use Roots\Acorn\View\Composer;
class App extends Composer
{
/**
* List of views served by this composer.
*
* @var array
*/
protected static $views = [
'*',
];
/**
* Data to be passed to view before rendering.
*
* @return array
*/
public function with()
{
return [
'siteName' => $this->siteName(),
];
}
/**
* Returns the site name.
*
* @return string
*/
public function siteName()
{
return get_bloginfo('name', 'display');
}
}

View File

@@ -0,0 +1,69 @@
<?php
namespace App\View\Composers;
use Roots\Acorn\View\Composer;
class Post extends Composer
{
/**
* List of views served by this composer.
*
* @var array
*/
protected static $views = [
'partials.page-header',
'partials.content',
'partials.content-*',
];
/**
* Data to be passed to view before rendering, but after merging.
*
* @return array
*/
public function override()
{
return [
'title' => $this->title(),
];
}
/**
* Returns the post title.
*
* @return string
*/
public function title()
{
if ($this->view->name() !== 'partials.page-header') {
return get_the_title();
}
if (is_home()) {
if ($home = get_option('page_for_posts', true)) {
return get_the_title($home);
}
return __('Latest Posts', 'sage');
}
if (is_archive()) {
return get_the_archive_title();
}
if (is_search()) {
/* translators: %s is replaced with the search query */
return sprintf(
__('Search Results for %s', 'sage'),
get_search_query()
);
}
if (is_404()) {
return __('Not Found', 'sage');
}
return get_the_title();
}
}

View File

@@ -1,12 +1,22 @@
<?php <?php
/**
* Theme admin.
*/
namespace App; namespace App;
use WP_Customize_Manager;
use function Roots\asset;
/** /**
* Theme customizer * Register the `.brand` selector as the blogname.
*
* @param \WP_Customize_Manager $wp_customize
* @return void
*/ */
add_action('customize_register', function (\WP_Customize_Manager $wp_customize) { add_action('customize_register', function (WP_Customize_Manager $wp_customize) {
// Add postMessage support
$wp_customize->get_setting('blogname')->transport = 'postMessage'; $wp_customize->get_setting('blogname')->transport = 'postMessage';
$wp_customize->selective_refresh->add_partial('blogname', [ $wp_customize->selective_refresh->add_partial('blogname', [
'selector' => '.brand', 'selector' => '.brand',
@@ -17,8 +27,10 @@ add_action('customize_register', function (\WP_Customize_Manager $wp_customize)
}); });
/** /**
* Customizer JS * Register the customizer assets.
*
* @return void
*/ */
add_action('customize_preview_init', function () { add_action('customize_preview_init', function () {
wp_enqueue_script('sage/customizer.js', asset_path('scripts/customizer.js'), ['customize-preview'], null, true); wp_enqueue_script('sage/customizer.js', asset('scripts/customizer.js')->uri(), ['customize-preview'], null, true);
}); });

View File

@@ -1,91 +1,16 @@
<?php <?php
/**
* Theme filters.
*/
namespace App; namespace App;
/** /**
* Add <body> classes * Add "… Continued" to the excerpt.
*/ *
add_filter('body_class', function (array $classes) { * @return string
/** Add page slug if it doesn't exist */
if (is_single() || is_page() && !is_front_page()) {
if (!in_array(basename(get_permalink()), $classes)) {
$classes[] = basename(get_permalink());
}
}
/** Add class if sidebar is active */
if (display_sidebar()) {
$classes[] = 'sidebar-primary';
}
/** Clean up class names for custom templates */
$classes = array_map(function ($class) {
return preg_replace(['/-blade(-php)?$/', '/^page-template-views/'], '', $class);
}, $classes);
return array_filter($classes);
});
/**
* Add "… Continued" to the excerpt
*/ */
add_filter('excerpt_more', function () { add_filter('excerpt_more', function () {
return ' &hellip; <a href="' . get_permalink() . '">' . __('Continued', 'sage') . '</a>'; return ' &hellip; <a href="' . get_permalink() . '">' . __('Continued', 'sage') . '</a>';
}); });
/**
* Template Hierarchy should search for .blade.php files
*/
collect([
'index', '404', 'archive', 'author', 'category', 'tag', 'taxonomy', 'date', 'home',
'frontpage', 'page', 'paged', 'search', 'single', 'singular', 'attachment', 'embed'
])->map(function ($type) {
add_filter("{$type}_template_hierarchy", __NAMESPACE__.'\\filter_templates');
});
/**
* Render page using Blade
*/
add_filter('template_include', function ($template) {
collect(['get_header', 'wp_head'])->each(function ($tag) {
ob_start();
do_action($tag);
$output = ob_get_clean();
remove_all_actions($tag);
add_action($tag, function () use ($output) {
echo $output;
});
});
$data = collect(get_body_class())->reduce(function ($data, $class) use ($template) {
return apply_filters("sage/template/{$class}/data", $data, $template);
}, []);
if ($template) {
echo template($template, $data);
return get_stylesheet_directory().'/index.php';
}
return $template;
}, PHP_INT_MAX);
/**
* Render comments.blade.php
*/
add_filter('comments_template', function ($comments_template) {
$comments_template = str_replace(
[get_stylesheet_directory(), get_template_directory()],
'',
$comments_template
);
$data = collect(get_body_class())->reduce(function ($data, $class) use ($comments_template) {
return apply_filters("sage/template/{$class}/data", $data, $comments_template);
}, []);
$theme_template = locate_template(["views/{$comments_template}", $comments_template]);
if ($theme_template) {
echo template($theme_template, $data);
return get_stylesheet_directory().'/index.php';
}
return $comments_template;
}, 100);

View File

@@ -1,138 +1,7 @@
<?php <?php
/**
* Theme helpers.
*/
namespace App; namespace App;
use Roots\Sage\Container;
/**
* Get the sage container.
*
* @param string $abstract
* @param array $parameters
* @param Container $container
* @return Container|mixed
*/
function sage($abstract = null, $parameters = [], Container $container = null)
{
$container = $container ?: Container::getInstance();
if (!$abstract) {
return $container;
}
return $container->bound($abstract)
? $container->makeWith($abstract, $parameters)
: $container->makeWith("sage.{$abstract}", $parameters);
}
/**
* Get / set the specified configuration value.
*
* If an array is passed as the key, we will assume you want to set an array of values.
*
* @param array|string $key
* @param mixed $default
* @return mixed|\Roots\Sage\Config
* @copyright Taylor Otwell
* @link https://github.com/laravel/framework/blob/c0970285/src/Illuminate/Foundation/helpers.php#L254-L265
*/
function config($key = null, $default = null)
{
if (is_null($key)) {
return sage('config');
}
if (is_array($key)) {
return sage('config')->set($key);
}
return sage('config')->get($key, $default);
}
/**
* @param string $file
* @param array $data
* @return string
*/
function template($file, $data = [])
{
return sage('blade')->render($file, $data);
}
/**
* Retrieve path to a compiled blade view
* @param $file
* @param array $data
* @return string
*/
function template_path($file, $data = [])
{
return sage('blade')->compiledPath($file, $data);
}
/**
* @param $asset
* @return string
*/
function asset_path($asset)
{
return sage('assets')->getUri($asset);
}
/**
* @param string|string[] $templates Possible template files
* @return array
*/
function filter_templates($templates)
{
$paths = apply_filters('sage/filter_templates/paths', [
'views',
'resources/views'
]);
$paths_pattern = "#^(" . implode('|', $paths) . ")/#";
return collect($templates)
->map(function ($template) use ($paths_pattern) {
/** Remove .blade.php/.blade/.php from template names */
$template = preg_replace('#\.(blade\.?)?(php)?$#', '', ltrim($template));
/** Remove partial $paths from the beginning of template names */
if (strpos($template, '/')) {
$template = preg_replace($paths_pattern, '', $template);
}
return $template;
})
->flatMap(function ($template) use ($paths) {
return collect($paths)
->flatMap(function ($path) use ($template) {
return [
"{$path}/{$template}.blade.php",
"{$path}/{$template}.php",
];
})
->concat([
"{$template}.blade.php",
"{$template}.php",
]);
})
->filter()
->unique()
->all();
}
/**
* @param string|string[] $templates Relative path to possible template files
* @return string Location of the template
*/
function locate_template($templates)
{
return \locate_template(filter_templates($templates));
}
/**
* Determine whether to show the sidebar
* @return bool
*/
function display_sidebar()
{
static $display;
isset($display) || $display = apply_filters('sage/display_sidebar', false);
return $display;
}

125
app/setup.php Normal file → Executable file
View File

@@ -1,26 +1,51 @@
<?php <?php
/**
* Theme setup.
*/
namespace App; namespace App;
use Roots\Sage\Container; use function Roots\asset;
use Roots\Sage\Assets\JsonManifest;
use Roots\Sage\Template\Blade;
use Roots\Sage\Template\BladeProvider;
/** /**
* Theme assets * Register the theme assets.
*
* @return void
*/ */
add_action('wp_enqueue_scripts', function () { add_action('wp_enqueue_scripts', function () {
wp_enqueue_style('sage/main.css', asset_path('styles/main.css'), false, null); wp_enqueue_script('sage/vendor.js', asset('scripts/vendor.js')->uri(), ['jquery'], null, true);
wp_enqueue_script('sage/main.js', asset_path('scripts/main.js'), ['jquery'], null, true); wp_enqueue_script('sage/app.js', asset('scripts/app.js')->uri(), ['sage/vendor.js', 'jquery'], null, true);
wp_add_inline_script('sage/vendor.js', asset('scripts/manifest.js')->contents(), 'before');
if (is_single() && comments_open() && get_option('thread_comments')) { if (is_single() && comments_open() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply'); wp_enqueue_script('comment-reply');
} }
wp_enqueue_style('sage/app.css', asset('styles/app.css')->uri(), false, null);
}, 100); }, 100);
/** /**
* Theme setup * Register the theme assets with the block editor.
*
* @return void
*/
add_action('enqueue_block_editor_assets', function () {
if ($manifest = asset('scripts/manifest.asset.php')->get()) {
wp_enqueue_script('sage/vendor.js', asset('scripts/vendor.js')->uri(), $manifest['dependencies'], null, true);
wp_enqueue_script('sage/editor.js', asset('scripts/editor.js')->uri(), ['sage/vendor.js'], null, true);
wp_add_inline_script('sage/vendor.js', asset('scripts/manifest.js')->contents(), 'before');
}
wp_enqueue_style('sage/editor.css', asset('styles/editor.css')->uri(), false, null);
}, 100);
/**
* Register the initial theme setup.
*
* @return void
*/ */
add_action('after_setup_theme', function () { add_action('after_setup_theme', function () {
/** /**
@@ -28,7 +53,6 @@ add_action('after_setup_theme', function () {
* @link https://roots.io/plugins/soil/ * @link https://roots.io/plugins/soil/
*/ */
add_theme_support('soil-clean-up'); add_theme_support('soil-clean-up');
add_theme_support('soil-jquery-cdn');
add_theme_support('soil-nav-walker'); add_theme_support('soil-nav-walker');
add_theme_support('soil-nice-search'); add_theme_support('soil-nice-search');
add_theme_support('soil-relative-urls'); add_theme_support('soil-relative-urls');
@@ -53,6 +77,18 @@ add_action('after_setup_theme', function () {
*/ */
add_theme_support('post-thumbnails'); add_theme_support('post-thumbnails');
/**
* Add theme support for Wide Alignment
* @link https://wordpress.org/gutenberg/handbook/designers-developers/developers/themes/theme-support/#wide-alignment
*/
add_theme_support('align-wide');
/**
* Enable responsive embeds
* @link https://wordpress.org/gutenberg/handbook/designers-developers/developers/themes/theme-support/#responsive-embedded-content
*/
add_theme_support('responsive-embeds');
/** /**
* Enable HTML5 markup support * Enable HTML5 markup support
* @link https://developer.wordpress.org/reference/functions/add_theme_support/#html5 * @link https://developer.wordpress.org/reference/functions/add_theme_support/#html5
@@ -66,67 +102,38 @@ add_action('after_setup_theme', function () {
add_theme_support('customize-selective-refresh-widgets'); add_theme_support('customize-selective-refresh-widgets');
/** /**
* Use main stylesheet for visual editor * Enable theme color palette support
* @see resources/assets/styles/layouts/_tinymce.scss * @link https://developer.wordpress.org/block-editor/developers/themes/theme-support/#block-color-palettes
*/ */
add_editor_style(asset_path('styles/main.css')); add_theme_support('editor-color-palette', [
[
'name' => __('Primary', 'sage'),
'slug' => 'primary',
'color' => '#525ddc',
]
]);
}, 20); }, 20);
/** /**
* Register sidebars * Register the theme sidebars.
*
* @return void
*/ */
add_action('widgets_init', function () { add_action('widgets_init', function () {
$config = [ $config = [
'before_widget' => '<section class="widget %1$s %2$s">', 'before_widget' => '<section class="widget %1$s %2$s">',
'after_widget' => '</section>', 'after_widget' => '</section>',
'before_title' => '<h3>', 'before_title' => '<h3>',
'after_title' => '</h3>' 'after_title' => '</h3>'
]; ];
register_sidebar([ register_sidebar([
'name' => __('Primary', 'sage'), 'name' => __('Primary', 'sage'),
'id' => 'sidebar-primary' 'id' => 'sidebar-primary'
] + $config); ] + $config);
register_sidebar([ register_sidebar([
'name' => __('Footer', 'sage'), 'name' => __('Footer', 'sage'),
'id' => 'sidebar-footer' 'id' => 'sidebar-footer'
] + $config); ] + $config);
}); });
/**
* Updates the `$post` variable on each iteration of the loop.
* Note: updated value is only available for subsequently loaded views, such as partials
*/
add_action('the_post', function ($post) {
sage('blade')->share('post', $post);
});
/**
* Setup Sage options
*/
add_action('after_setup_theme', function () {
/**
* Add JsonManifest to Sage container
*/
sage()->singleton('sage.assets', function () {
return new JsonManifest(config('assets.manifest'), config('assets.uri'));
});
/**
* Add Blade to Sage container
*/
sage()->singleton('sage.blade', function (Container $app) {
$cachePath = config('view.compiled');
if (!file_exists($cachePath)) {
wp_mkdir_p($cachePath);
}
(new BladeProvider($app))->register();
return new Blade($app['view']);
});
/**
* Create @asset() Blade directive
*/
sage('blade')->compiler()->directive('asset', function ($asset) {
return "<?= " . __NAMESPACE__ . "\\asset_path({$asset}); ?>";
});
});

View File

@@ -19,9 +19,16 @@
"name": "QWp6t", "name": "QWp6t",
"email": "hi@qwp6t.me", "email": "hi@qwp6t.me",
"homepage": "https://github.com/qwp6t" "homepage": "https://github.com/qwp6t"
},
{
"name": "Brandon Nifong",
"email": "brandon@tendency.me",
"homepage": "https://github.com/log1x"
} }
], ],
"keywords": ["wordpress"], "keywords": [
"wordpress"
],
"support": { "support": {
"issues": "https://github.com/roots/sage/issues", "issues": "https://github.com/roots/sage/issues",
"forum": "https://discourse.roots.io/" "forum": "https://discourse.roots.io/"
@@ -32,20 +39,30 @@
} }
}, },
"require": { "require": {
"php": ">=7.1", "php": "^7.2.5",
"composer/installers": "~1.0", "roots/acorn": "^1.0.1"
"illuminate/support": "5.6.*",
"roots/sage-lib": "~9.0.9",
"soberwp/controller": "~2.1.0"
}, },
"require-dev": { "require-dev": {
"squizlabs/php_codesniffer": "^2.8.0", "filp/whoops": "^2.7",
"roots/sage-installer": "~1.6" "squizlabs/php_codesniffer": "^3.5"
}, },
"suggest": {
"log1x/sage-directives": "A collection of useful Blade directives for WordPress and Sage (^1.0).",
"log1x/sage-svg": "Provides a useful SVG directive for properly inlining SVG's within your Blade views (^1.0)."
},
"config": {
"optimize-autoloader": true,
"preferred-install": "dist",
"sort-packages": true
},
"minimum-stability": "dev",
"prefer-stable": true,
"scripts": { "scripts": {
"test": ["phpcs"], "lint": [
"post-create-project-cmd": [ "phpcs --ignore=index.php,vendor,resources,storage,dist --extensions=php --standard=PSR12 ."
"Roots\\Sage\\Installer\\ComposerScript::postCreateProject" ],
"post-autoload-dump": [
"Roots\\Acorn\\ComposerScripts::postAutoloadDump"
] ]
} }
} }

1984
composer.lock generated

File diff suppressed because it is too large Load Diff

183
config/app.php Normal file
View File

@@ -0,0 +1,183 @@
<?php
use function Roots\env;
return [
/*
|--------------------------------------------------------------------------
| Application Name
|--------------------------------------------------------------------------
|
| This value is the name of your application. This value is used when the
| framework needs to place the application's name in a notification or
| any other location as required by the application or its packages.
|
*/
'name' => env('APP_NAME', wp_get_theme()->get('Name')),
/*
|--------------------------------------------------------------------------
| Application Environment
|--------------------------------------------------------------------------
|
| This value determines the "environment" your application is currently
| running in. This may determine how you prefer to configure various
| services your application utilizes. Set this in your ".env" file.
|
*/
'env' => defined('WP_ENV') ? WP_ENV : env('WP_ENV', 'production'),
/*
|--------------------------------------------------------------------------
| Application Debug Mode
|--------------------------------------------------------------------------
|
| When your application is in debug mode, detailed error messages with
| stack traces will be shown on every error that occurs within your
| application. If disabled, a simple generic error page is shown.
|
*/
'debug' => WP_DEBUG,
/*
|--------------------------------------------------------------------------
| Application Timezone
|--------------------------------------------------------------------------
|
| Here you may specify the default timezone for your application, which
| will be used by the PHP date and date-time functions. We have gone
| ahead and set this to a sensible default for you out of the box.
|
*/
'timezone' => get_option('timezone_string', 'UTC'),
/*
|--------------------------------------------------------------------------
| Preflight Checks
|--------------------------------------------------------------------------
|
| This value allows service providers to execute preflight tasks after
| booting. These tasks include creating directories, databases, and files,
| or doing any other checks to ensure the service is functional.
|
*/
'preflight' => env('WP_ENV', 'production') !== 'production',
/*
|--------------------------------------------------------------------------
| Global Helpers
|--------------------------------------------------------------------------
|
| This value enables the usage of various Acorn helpers without the need
| to specify a namespace. This defaults to false as to not pollute the
| global namespace.
|
*/
'globals' => false,
/*
|--------------------------------------------------------------------------
| Application Locale Configuration
|--------------------------------------------------------------------------
|
| The application locale determines the default locale that will be used
| by the translation service provider. You are free to set this value
| to any of the locales which will be supported by the application.
|
*/
'locale' => get_locale(),
/*
|--------------------------------------------------------------------------
| Application Fallback Locale
|--------------------------------------------------------------------------
|
| The fallback locale determines the locale to use when the current one
| is not available. You may change the value to correspond to any of
| the language folders that are provided through your application.
|
*/
'fallback_locale' => 'en',
/*
|--------------------------------------------------------------------------
| Autoloaded Service Providers
|--------------------------------------------------------------------------
|
| The service providers listed here will be automatically loaded on the
| request to your application. Feel free to add your own services to
| this array to grant expanded functionality to your applications.
|
*/
'providers' => [
/**
* Package Service Providers
*/
// ExamplePackage\Providers\ExamplePackageServiceProvider::class,
/**
* Application Service Providers
*/
App\Providers\ThemeServiceProvider::class,
],
/*
|--------------------------------------------------------------------------
| Class Aliases
|--------------------------------------------------------------------------
|
| This array of class aliases will be registered when this application
| is started. However, feel free to register as many as you wish as
| the aliases are "lazy" loaded so they don't hinder performance.
|
*/
'aliases' => [
'App' => Illuminate\Support\Facades\App::class,
'Arr' => Illuminate\Support\Arr::class,
'Artisan' => Illuminate\Support\Facades\Artisan::class,
'Auth' => Illuminate\Support\Facades\Auth::class,
'Blade' => Illuminate\Support\Facades\Blade::class,
'Broadcast' => Illuminate\Support\Facades\Broadcast::class,
'Bus' => Illuminate\Support\Facades\Bus::class,
'Cache' => Illuminate\Support\Facades\Cache::class,
'Config' => Illuminate\Support\Facades\Config::class,
'Cookie' => Illuminate\Support\Facades\Cookie::class,
'Crypt' => Illuminate\Support\Facades\Crypt::class,
'DB' => Illuminate\Support\Facades\DB::class,
'Eloquent' => Illuminate\Database\Eloquent\Model::class,
'Event' => Illuminate\Support\Facades\Event::class,
'File' => Illuminate\Support\Facades\File::class,
'Gate' => Illuminate\Support\Facades\Gate::class,
'Hash' => Illuminate\Support\Facades\Hash::class,
'Http' => Illuminate\Support\Facades\Http::class,
'Lang' => Illuminate\Support\Facades\Lang::class,
'Log' => Illuminate\Support\Facades\Log::class,
'Mail' => Illuminate\Support\Facades\Mail::class,
'Notification' => Illuminate\Support\Facades\Notification::class,
'Password' => Illuminate\Support\Facades\Password::class,
'Queue' => Illuminate\Support\Facades\Queue::class,
'Redirect' => Illuminate\Support\Facades\Redirect::class,
'Redis' => Illuminate\Support\Facades\Redis::class,
'Request' => Illuminate\Support\Facades\Request::class,
'Response' => Illuminate\Support\Facades\Response::class,
'Route' => Illuminate\Support\Facades\Route::class,
'Schema' => Illuminate\Support\Facades\Schema::class,
'Session' => Illuminate\Support\Facades\Session::class,
'Storage' => Illuminate\Support\Facades\Storage::class,
'Str' => Illuminate\Support\Str::class,
'URL' => Illuminate\Support\Facades\URL::class,
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
],
];

View File

@@ -4,28 +4,39 @@ return [
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Assets Manifest | Default Assets Manifest
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| Your asset manifest is used by Sage to assist WordPress and your views | Here you may specify the default asset manifest that should be used.
| with rendering the correct URLs for your assets. This is especially | The "theme" manifest is recommended as the default as it cedes ultimate
| useful for statically referencing assets with dynamically changing names | authority of your application's assets to the theme.
| as in the case of cache-busting.
| |
*/ */
'manifest' => get_theme_file_path().'/dist/assets.json', 'default' => 'theme',
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Assets Path URI | Assets Manifests
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| |
| The asset manifest contains relative paths to your assets. This URI will | Manifests contain lists of assets that are referenced by static keys that
| be prepended when using Sage's asset management system. Change this if | point to dynamic locations, such as a cache-busted location. A manifest
| you are using a CDN. | may employ any number of strategies for determining absolute local and
| remote paths to assets.
|
| Supported Strategies: "relative"
|
| Note: We will add first-party support for more strategies in the future.
| |
*/ */
'uri' => get_theme_file_uri().'/dist', 'manifests' => [
'theme' => [
'strategy' => 'relative',
'path' => get_theme_file_path('/dist'),
'uri' => get_theme_file_uri('/dist'),
'manifest' => get_theme_file_path('/dist/mix-manifest.json'),
]
]
]; ];

70
config/filesystems.php Normal file
View File

@@ -0,0 +1,70 @@
<?php
use function Roots\env;
return [
/*
|--------------------------------------------------------------------------
| Default Filesystem Disk
|--------------------------------------------------------------------------
|
| Here you may specify the default filesystem disk that should be used
| by the framework. The "local" disk, as well as a variety of cloud
| based disks are available to your application. Just store away!
|
*/
'default' => env('FILESYSTEM_DRIVER', 'local'),
/*
|--------------------------------------------------------------------------
| Default Cloud Filesystem Disk
|--------------------------------------------------------------------------
|
| Many applications store files both locally and in the cloud. For this
| reason, you may specify a default "cloud" driver here. This driver
| will be bound as the Cloud disk implementation in the container.
|
*/
'cloud' => env('FILESYSTEM_CLOUD', 's3'),
/*
|--------------------------------------------------------------------------
| Filesystem Disks
|--------------------------------------------------------------------------
|
| Here you may configure as many filesystem "disks" as you wish, and you
| may even configure multiple disks of the same driver. Defaults have
| been setup for each driver as an example of the required options.
|
| Supported Drivers: "local", "ftp", "sftp", "s3"
|
*/
'disks' => [
'local' => [
'driver' => 'local',
'root' => WP_CONTENT_DIR,
'url' => content_url(),
'visibility' => 'public',
],
'wordpress' => [
'driver' => 'local',
'root' => ABSPATH,
'url' => site_url(),
'visibility' => 'public',
],
's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
'secret' => env('AWS_SECRET_ACCESS_KEY'),
'region' => env('AWS_DEFAULT_REGION'),
'bucket' => env('AWS_BUCKET'),
'url' => env('AWS_URL'),
],
],
];

106
config/logging.php Normal file
View File

@@ -0,0 +1,106 @@
<?php
use Monolog\Handler\NullHandler;
use Monolog\Handler\StreamHandler;
use Monolog\Handler\SyslogUdpHandler;
use function Roots\env;
use function Roots\storage_path;
return [
/*
|--------------------------------------------------------------------------
| Default Log Channel
|--------------------------------------------------------------------------
|
| This option defines the default log channel that gets used when writing
| messages to the logs. The name specified in this option should match
| one of the channels defined in the "channels" configuration array.
|
*/
'default' => env('LOG_CHANNEL', 'stack'),
/*
|--------------------------------------------------------------------------
| Log Channels
|--------------------------------------------------------------------------
|
| Here you may configure the log channels for your application. Out of
| the box, the framework uses the Monolog PHP logging library. This gives
| you a variety of powerful log handlers / formatters to utilize.
|
| Available Drivers: "single", "daily", "slack", "syslog",
| "errorlog", "monolog",
| "custom", "stack"
|
*/
'channels' => [
'stack' => [
'driver' => 'stack',
'channels' => ['single'],
'ignore_exceptions' => false,
],
'single' => [
'driver' => 'single',
'path' => storage_path('logs/sage.log'),
'level' => 'debug',
],
'daily' => [
'driver' => 'daily',
'path' => storage_path('logs/sage.log'),
'level' => 'debug',
'days' => 14,
],
'slack' => [
'driver' => 'slack',
'url' => env('LOG_SLACK_WEBHOOK_URL'),
'username' => 'App Log',
'emoji' => ':boom:',
'level' => 'critical',
],
'papertrail' => [
'driver' => 'monolog',
'level' => 'debug',
'handler' => SyslogUdpHandler::class,
'handler_with' => [
'host' => env('PAPERTRAIL_URL'),
'port' => env('PAPERTRAIL_PORT'),
],
],
'stderr' => [
'driver' => 'monolog',
'handler' => StreamHandler::class,
'formatter' => env('LOG_STDERR_FORMATTER'),
'with' => [
'stream' => 'php://stderr',
],
],
'syslog' => [
'driver' => 'syslog',
'level' => 'debug',
],
'errorlog' => [
'driver' => 'errorlog',
'level' => 'debug',
],
'null' => [
'driver' => 'monolog',
'handler' => NullHandler::class,
],
'emergency' => [
'path' => storage_path('logs/sage.log'),
],
],
];

View File

@@ -1,32 +0,0 @@
<?php
return [
/*
|--------------------------------------------------------------------------
| Theme Directory
|--------------------------------------------------------------------------
|
| This is the absolute path to your theme directory.
|
| Example:
| /srv/www/example.com/current/web/app/themes/sage
|
*/
'dir' => get_theme_file_path(),
/*
|--------------------------------------------------------------------------
| Theme Directory URI
|--------------------------------------------------------------------------
|
| This is the web server URI to your theme directory.
|
| Example:
| https://example.com/app/themes/sage
|
*/
'uri' => get_theme_file_uri(),
];

41
config/view.php Normal file → Executable file
View File

@@ -13,11 +13,10 @@ return [
*/ */
'paths' => [ 'paths' => [
get_theme_file_path().'/resources/views', get_theme_file_path('/resources/views'),
get_parent_theme_file_path().'/resources/views', get_parent_theme_file_path('/resources/views'),
], ],
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Compiled View Path | Compiled View Path
@@ -29,8 +28,21 @@ return [
| |
*/ */
'compiled' => wp_upload_dir()['basedir'].'/cache', 'compiled' => get_theme_file_path('/storage/framework/views'),
/*
|--------------------------------------------------------------------------
| View Debugger
|--------------------------------------------------------------------------
|
| Enabling this option will display the current view name and data. Giving
| it a value of 'view' will only display view names. Giving it a value of
| 'data' will only display current data. Giving it any other truthy value
| will display both.
|
*/
'debug' => false,
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
@@ -45,7 +57,24 @@ return [
*/ */
'namespaces' => [ 'namespaces' => [
/* Given the below example, in your views use something like: @include('WC::some.view.or.partial.here') */ /*
// 'WC' => WP_PLUGIN_DIR.'/woocommerce/templates/', | Given the below example, in your views use something like:
| @include('MyPlugin::some.view.or.partial.here')
*/
// 'MyPlugin' => WP_PLUGIN_DIR . '/my-plugin/resources/views',
],
/*
|--------------------------------------------------------------------------
| View Directives
|--------------------------------------------------------------------------
|
| The namespaces where view components reside. Components can be referenced
| with camelCase & dot notation.
|
*/
'directives' => [
'asset' => Roots\Acorn\Assets\AssetDirective::class,
], ],
]; ];

68
functions.php Normal file
View File

@@ -0,0 +1,68 @@
<?php
/*
|--------------------------------------------------------------------------
| Register The Auto Loader
|--------------------------------------------------------------------------
|
| Composer provides a convenient, automatically generated class loader for
| our theme. We will simply require it into the script here so that we
| don't have to worry about manually loading any of our classes later on.
|
*/
if (! file_exists($composer = __DIR__ . '/vendor/autoload.php')) {
wp_die(__('Error locating autoloader. Please run <code>composer install</code>.', 'sage'));
}
require $composer;
/*
|--------------------------------------------------------------------------
| Register Sage Theme Files
|--------------------------------------------------------------------------
|
| Out of the box, Sage ships with categorically named theme files
| containing common functionality and setup to be bootstrapped with your
| theme. Simply add (or remove) files from the array below to change what
| is registered alongside Sage.
|
*/
collect(['helpers', 'setup', 'filters', 'admin'])
->each(function ($file) {
$file = "app/{$file}.php";
if (! locate_template($file, true, true)) {
wp_die(
sprintf(__('Error locating <code>%s</code> for inclusion.', 'sage'), $file)
);
}
});
/*
|--------------------------------------------------------------------------
| Enable Sage Theme Support
|--------------------------------------------------------------------------
|
| Once our theme files are registered and available for use, we are almost
| ready to boot our application. But first, we need to signal to Acorn
| that we will need to initialize the necessary service providers built in
| for Sage when booting.
|
*/
add_theme_support('sage');
/*
|--------------------------------------------------------------------------
| Turn On The Lights
|--------------------------------------------------------------------------
|
| We are ready to bootstrap the Acorn framework and get it ready for use.
| Acorn will provide us support for Blade templating as well as the ability
| to utilize the Laravel framework and its beautifully written packages.
|
*/
new Roots\Acorn\Bootloader();

21
index.php Normal file
View File

@@ -0,0 +1,21 @@
<!doctype html>
<html <?php language_attributes(); ?>>
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<?php wp_head(); ?>
</head>
<body <?php body_class(); ?>>
<?php wp_body_open(); ?>
<?php do_action('get_header'); ?>
<div id="app">
<?php echo \Roots\view(\Roots\app('sage.view'), \Roots\app('sage.data'))->render(); ?>
</div>
<?php do_action('get_footer'); ?>
<?php wp_footer(); ?>
</body>
</html>

17788
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,83 +1,53 @@
{ {
"name": "sage",
"version": "9.0.9",
"author": "Roots <team@roots.io>",
"homepage": "https://roots.io/sage/",
"private": true, "private": true,
"repository": {
"type": "git",
"url": "git://github.com/roots/sage.git"
},
"bugs": {
"url": "https://github.com/roots/sage/issues"
},
"licenses": [
{
"type": "MIT",
"url": "http://opensource.org/licenses/MIT"
}
],
"browserslist": [ "browserslist": [
"last 2 versions", "extends @wordpress/browserslist-config"
"android 4",
"opera 12"
], ],
"scripts": { "scripts": {
"build": "webpack --progress --config resources/assets/build/webpack.config.js", "build": "cross-env NODE_ENV=development run-s mix",
"build:production": "webpack --env.production --progress --config resources/assets/build/webpack.config.js", "build:production": "cross-env NODE_ENV=production run-s clean mix",
"build:profile": "webpack --progress --profile --json --config resources/assets/build/webpack.config.js", "start": "cross-env NODE_ENV=development run-s \"mix -- --watch\"",
"start": "webpack --hide-modules --watch --config resources/assets/build/webpack.config.js", "hot": "cross-env NODE_ENV=development run-s build mix:hot",
"rmdist": "rimraf dist", "mix": "webpack --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
"lint": "npm run -s lint:scripts && npm run -s lint:styles", "mix:hot": "webpack-dev-server --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
"lint:scripts": "eslint resources/assets/scripts resources/assets/build", "clean": "run-p clean:*",
"lint:styles": "stylelint \"resources/assets/styles/**/*.{css,sass,scss,sss,less}\"", "clean:dist": "rimraf dist",
"test": "npm run -s lint" "clean:cache": "rimraf storage/framework/cache/*.php storage/framework/cache/data/*.php",
}, "clean:views": "rimraf storage/framework/views/*.php",
"engines": { "lint": "run-s -c lint:*",
"node": ">= 8.0.0" "lint:scripts": "eslint resources/assets/scripts",
"lint:styles": "stylelint \"resources/assets/**/*.{vue,css,sass,scss,less}\"",
"test": "run-s -c lint",
"translate": "run-s -c translate:*",
"translate:pot": "wp i18n make-pot . ./resources/languages/sage.pot --ignore-domain --include=\"app,resources/assets,resources/views\"",
"translate:js": "wp i18n make-json ./resources/languages --no-purge --pretty-print"
}, },
"devDependencies": { "devDependencies": {
"autoprefixer": "~8.2.0", "@tinypixelco/laravel-mix-wp-blocks": "^1.0.0",
"browser-sync": "~2.24.7", "@wordpress/babel-preset-default": "^4.12.1",
"browsersync-webpack-plugin": "^0.6.0", "@wordpress/browserslist-config": "^2.6.0",
"bs-html-injector": "~3.0", "@wordpress/dependency-extraction-webpack-plugin": "^2.5.0",
"buble-loader": "^0.4.1", "babel-eslint": "^10.1.0",
"cache-loader": "~1.2.5", "browser-sync": "^2.26.7",
"clean-webpack-plugin": "^0.1.18", "browser-sync-webpack-plugin": "^2.0.1",
"copy-globs-webpack-plugin": "^0.2.0", "cross-env": "^7.0.2",
"css-loader": "^0.28.9", "eslint": "^6.8.0",
"cssnano": "~4.0.5", "eslint-plugin-import": "^2.20.2",
"eslint": "~4.19.1", "laravel-mix": "^5.0.4",
"eslint-loader": "~1.9", "laravel-mix-copy-watched": "^2.2.4",
"eslint-plugin-import": "~2.14.0", "laravel-mix-purgecss": "^5.0.0-rc.1",
"extract-text-webpack-plugin": "~3.0.2", "npm-run-all": "^4.1",
"file-loader": "^1.1.6", "purgecss-with-wordpress": "^2.1.0",
"friendly-errors-webpack-plugin": "^1.6.1", "rimraf": "^3.0.2",
"imagemin-mozjpeg": "~7.0.0", "sass": "^1.26.3",
"imagemin-webpack-plugin": "~2.2.0", "sass-loader": "^8.0.2",
"import-glob": "~1.5", "stylelint": "^13.3.3",
"node-sass": "~4.9.4", "stylelint-config-standard": "^20.0.0",
"postcss-loader": "~2.1.0", "vue-template-compiler": "^2.6.11"
"postcss-safe-parser": "~3.0",
"resolve-url-loader": "~2.3.1",
"rimraf": "~2.6",
"sass-loader": "~6.0",
"style-loader": "^0.22.1",
"stylelint": "^8.4.0",
"stylelint-config-standard": "~18.2.0",
"stylelint-webpack-plugin": "^0.10.5",
"uglifyjs-webpack-plugin": "^1.3.0",
"url-loader": "^0.6.2",
"webpack": "~3.10.0",
"webpack-assets-manifest": "^1.0.0",
"webpack-dev-middleware": "~2.0.4",
"webpack-hot-middleware": "~2.22.3",
"webpack-merge": "~4.1.4",
"yargs": "~11.0.0"
}, },
"dependencies": { "dependencies": {
"bootstrap": "v4.3.1", "bootstrap": "^4.4.1",
"jquery": "^3.3.1", "jquery": "^3.5.0",
"popper.js": "^1.14.7" "popper.js": "^1.16.1"
} }
} }

View File

@@ -1,71 +0,0 @@
<?xml version="1.0"?>
<ruleset name="Roots">
<description>Roots Coding Standards</description>
<!-- Scan these files -->
<file>resources/functions.php</file>
<file>resources/index.php</file>
<file>app</file>
<file>resources/views</file>
<!-- Show colors in console -->
<arg value="-colors"/>
<!-- Show sniff codes in all reports -->
<arg value="s"/>
<!-- Use PSR-2 as a base -->
<rule ref="PSR2"/>
<!-- Exclusions below are for resources/views/ folder -->
<!-- Allow php files without any PHP in them -->
<rule ref="Internal.NoCodeFound">
<exclude-pattern>resources/views</exclude-pattern>
</rule>
<!-- Allow braces on same line for named functions -->
<rule ref="Squiz.Functions.MultiLineFunctionDeclaration.BraceOnSameLine">
<exclude-pattern>resources/views</exclude-pattern>
</rule>
<!-- Allow closing braces to be on the same line -->
<rule ref="Squiz.WhiteSpace.ScopeClosingBrace">
<exclude-pattern>resources/views</exclude-pattern>
</rule>
<!-- Disable newline after opening brace -->
<rule ref="Squiz.ControlStructures.ControlSignature.NewlineAfterOpenBrace">
<exclude-pattern>resources/views</exclude-pattern>
</rule>
<!-- Allow multiple PHP statements in the same line -->
<rule ref="Generic.Formatting.DisallowMultipleStatements.SameLine">
<exclude-pattern>resources/views</exclude-pattern>
</rule>
<!-- Disable PSR-2 indentation rules that are buggy with 2 spaces -->
<rule ref="PSR2.ControlStructures.SwitchDeclaration.BreakIndent">
<exclude-pattern>resources/views</exclude-pattern>
</rule>
<!-- Don't require a blank line after the last `use` -->
<rule ref="PSR2.Namespaces.UseDeclaration.SpaceAfterLastUse">
<exclude-pattern>resources/views</exclude-pattern>
</rule>
<!-- Allow long lines -->
<rule ref="Generic.Files.LineLength.TooLong">
<exclude-pattern>resources/views</exclude-pattern>
</rule>
<!-- Ignore indentation rules -->
<rule ref="Generic.WhiteSpace.ScopeIndent">
<exclude-pattern>resources/views</exclude-pattern>
</rule>
<!-- Allow PHP closing tags -->
<rule ref="PSR2.Files.ClosingTag.NotAllowed">
<exclude-pattern>resources/views</exclude-pattern>
</rule>
</ruleset>

View File

@@ -1,60 +0,0 @@
const path = require('path');
const { argv } = require('yargs');
const merge = require('webpack-merge');
const desire = require('./util/desire');
const userConfig = merge(desire(`${__dirname}/../config`), desire(`${__dirname}/../config-local`));
const isProduction = !!((argv.env && argv.env.production) || argv.p);
const rootPath = (userConfig.paths && userConfig.paths.root)
? userConfig.paths.root
: process.cwd();
const config = merge({
open: true,
copy: 'images/**/*',
proxyUrl: 'http://localhost:3000',
cacheBusting: '[name]_[hash]',
paths: {
root: rootPath,
assets: path.join(rootPath, 'resources/assets'),
dist: path.join(rootPath, 'dist'),
},
enabled: {
sourceMaps: !isProduction,
optimize: isProduction,
cacheBusting: isProduction,
watcher: !!argv.watch,
},
watch: [],
}, userConfig);
module.exports = merge(config, {
env: Object.assign({ production: isProduction, development: !isProduction }, argv.env),
publicPath: `${config.publicPath}/${path.basename(config.paths.dist)}/`,
manifest: {},
});
if (process.env.NODE_ENV === undefined) {
process.env.NODE_ENV = isProduction ? 'production' : 'development';
}
/**
* If your publicPath differs between environments, but you know it at compile time,
* then set SAGE_DIST_PATH as an environment variable before compiling.
* Example:
* SAGE_DIST_PATH=/wp-content/themes/sage/dist/ yarn build:production
*/
if (process.env.SAGE_DIST_PATH) {
module.exports.publicPath = process.env.SAGE_DIST_PATH;
}
/**
* If you don't know your publicPath at compile time, then uncomment the lines
* below and use WordPress's wp_localize_script() to set SAGE_DIST_PATH global.
* Example:
* wp_localize_script('sage/main.js', 'SAGE_DIST_PATH', get_theme_file_uri('dist/'))
*/
// Object.keys(module.exports.entry).forEach(id =>
// module.exports.entry[id].unshift(path.join(__dirname, 'helpers/public-path.js')));

View File

@@ -1,7 +0,0 @@
const hotMiddlewareScript = require('webpack-hot-middleware/client?noInfo=true&timeout=20000&reload=true');
hotMiddlewareScript.subscribe(event => {
if (event.action === 'reload') {
window.location.reload();
}
});

View File

@@ -1,7 +0,0 @@
/* eslint-env browser */
/* globals SAGE_DIST_PATH */
/** Dynamically set absolute public path from current protocol and host */
if (SAGE_DIST_PATH) {
__webpack_public_path__ = SAGE_DIST_PATH; // eslint-disable-line no-undef, camelcase
}

View File

@@ -1,15 +0,0 @@
/* eslint-disable */
const cssnanoConfig = {
preset: ['default', { discardComments: { removeAll: true } }]
};
module.exports = ({ file, options }) => {
return {
parser: options.enabled.optimize ? 'postcss-safe-parser' : undefined,
plugins: {
autoprefixer: true,
cssnano: options.enabled.optimize ? cssnanoConfig : false,
},
};
};

View File

@@ -1,15 +0,0 @@
/**
* Loop through webpack entry
* and add the hot middleware
* @param {Object} entry webpack entry
* @return {Object} entry with hot middleware
*/
module.exports = (entry) => {
const results = {};
Object.keys(entry).forEach((name) => {
results[name] = Array.isArray(entry[name]) ? entry[name].slice(0) : [entry[name]];
results[name].unshift(`${__dirname}/../helpers/hmr-client.js`);
});
return results;
};

View File

@@ -1,34 +0,0 @@
const path = require('path');
module.exports = (key, value) => {
if (typeof value === 'string') {
return value;
}
const manifest = value;
/**
* Hack to prepend scripts/ or styles/ to manifest keys
*
* This might need to be reworked at some point.
*
* Before:
* {
* "main.js": "scripts/main_abcdef.js"
* "main.css": "styles/main_abcdef.css"
* }
* After:
* {
* "scripts/main.js": "scripts/main_abcdef.js"
* "styles/main.css": "styles/main_abcdef.css"
* }
*/
Object.keys(manifest).forEach((src) => {
const sourcePath = path.basename(path.dirname(src));
const targetPath = path.basename(path.dirname(manifest[src]));
if (sourcePath === targetPath) {
return;
}
manifest[`${targetPath}/${src}`] = manifest[src];
delete manifest[src];
});
return manifest;
};

View File

@@ -1,14 +0,0 @@
/**
* @export
* @param {string} dependency
* @param {any} [fallback]
* @return {any}
*/
module.exports = (dependency, fallback) => {
try {
require.resolve(dependency);
} catch (err) {
return fallback;
}
return require(dependency); // eslint-disable-line import/no-dynamic-require
};

View File

@@ -1,228 +0,0 @@
'use strict'; // eslint-disable-line
const webpack = require('webpack');
const merge = require('webpack-merge');
const CleanPlugin = require('clean-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const StyleLintPlugin = require('stylelint-webpack-plugin');
const CopyGlobsPlugin = require('copy-globs-webpack-plugin');
const FriendlyErrorsWebpackPlugin = require('friendly-errors-webpack-plugin');
const desire = require('./util/desire');
const config = require('./config');
const assetsFilenames = (config.enabled.cacheBusting) ? config.cacheBusting : '[name]';
let webpackConfig = {
context: config.paths.assets,
entry: config.entry,
devtool: (config.enabled.sourceMaps ? '#source-map' : undefined),
output: {
path: config.paths.dist,
publicPath: config.publicPath,
filename: `scripts/${assetsFilenames}.js`,
},
stats: {
hash: false,
version: false,
timings: false,
children: false,
errors: false,
errorDetails: false,
warnings: false,
chunks: false,
modules: false,
reasons: false,
source: false,
publicPath: false,
},
module: {
rules: [
{
enforce: 'pre',
test: /\.js$/,
include: config.paths.assets,
use: 'eslint',
},
{
enforce: 'pre',
test: /\.(js|s?[ca]ss)$/,
include: config.paths.assets,
loader: 'import-glob',
},
{
test: /\.js$/,
exclude: [/node_modules(?![/|\\](bootstrap|foundation-sites))/],
use: [
{ loader: 'cache' },
{ loader: 'buble', options: { objectAssign: 'Object.assign' } },
],
},
{
test: /\.css$/,
include: config.paths.assets,
use: ExtractTextPlugin.extract({
fallback: 'style',
use: [
{ loader: 'cache' },
{ loader: 'css', options: { sourceMap: config.enabled.sourceMaps } },
{
loader: 'postcss', options: {
config: { path: __dirname, ctx: config },
sourceMap: config.enabled.sourceMaps,
},
},
],
}),
},
{
test: /\.scss$/,
include: config.paths.assets,
use: ExtractTextPlugin.extract({
fallback: 'style',
use: [
{ loader: 'cache' },
{ loader: 'css', options: { sourceMap: config.enabled.sourceMaps } },
{
loader: 'postcss', options: {
config: { path: __dirname, ctx: config },
sourceMap: config.enabled.sourceMaps,
},
},
{ loader: 'resolve-url', options: { sourceMap: config.enabled.sourceMaps } },
{
loader: 'sass', options: {
sourceMap: config.enabled.sourceMaps,
sourceComments: true,
},
},
],
}),
},
{
test: /\.(ttf|otf|eot|woff2?|png|jpe?g|gif|svg|ico)$/,
include: config.paths.assets,
loader: 'url',
options: {
limit: 4096,
name: `[path]${assetsFilenames}.[ext]`,
},
},
{
test: /\.(ttf|otf|eot|woff2?|png|jpe?g|gif|svg|ico)$/,
include: /node_modules/,
loader: 'url',
options: {
limit: 4096,
outputPath: 'vendor/',
name: `${config.cacheBusting}.[ext]`,
},
},
],
},
resolve: {
modules: [
config.paths.assets,
'node_modules',
],
enforceExtension: false,
},
resolveLoader: {
moduleExtensions: ['-loader'],
},
externals: {
jquery: 'jQuery',
},
plugins: [
new CleanPlugin([config.paths.dist], {
root: config.paths.root,
verbose: false,
}),
/**
* It would be nice to switch to copy-webpack-plugin, but
* unfortunately it doesn't provide a reliable way of
* tracking the before/after file names
*/
new CopyGlobsPlugin({
pattern: config.copy,
output: `[path]${assetsFilenames}.[ext]`,
manifest: config.manifest,
}),
new ExtractTextPlugin({
filename: `styles/${assetsFilenames}.css`,
allChunks: true,
disable: (config.enabled.watcher),
}),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
Popper: 'popper.js/dist/umd/popper.js',
}),
new webpack.LoaderOptionsPlugin({
minimize: config.enabled.optimize,
debug: config.enabled.watcher,
stats: { colors: true },
}),
new webpack.LoaderOptionsPlugin({
test: /\.s?css$/,
options: {
output: { path: config.paths.dist },
context: config.paths.assets,
},
}),
new webpack.LoaderOptionsPlugin({
test: /\.js$/,
options: {
eslint: { failOnWarning: false, failOnError: true },
},
}),
new StyleLintPlugin({
failOnError: !config.enabled.watcher,
syntax: 'scss',
}),
new FriendlyErrorsWebpackPlugin(),
],
};
/* eslint-disable global-require */ /** Let's only load dependencies as needed */
if (config.enabled.optimize) {
webpackConfig = merge(webpackConfig, require('./webpack.config.optimize'));
}
if (config.env.production) {
webpackConfig.plugins.push(new webpack.NoEmitOnErrorsPlugin());
}
if (config.enabled.cacheBusting) {
const WebpackAssetsManifest = require('webpack-assets-manifest');
webpackConfig.plugins.push(
new WebpackAssetsManifest({
output: 'assets.json',
space: 2,
writeToDisk: false,
assets: config.manifest,
replacer: require('./util/assetManifestsFormatter'),
})
);
}
if (config.enabled.watcher) {
webpackConfig.entry = require('./util/addHotMiddleware')(webpackConfig.entry);
webpackConfig = merge(webpackConfig, require('./webpack.config.watch'));
}
/**
* During installation via sage-installer (i.e. composer create-project) some
* presets may generate a preset specific config (webpack.config.preset.js) to
* override some of the default options set here. We use webpack-merge to merge
* them in. If you need to modify Sage's default webpack config, we recommend
* that you modify this file directly, instead of creating your own preset
* file, as there are limitations to using webpack-merge which can hinder your
* ability to change certain options.
*/
module.exports = merge.smartStrategy({
'module.loaders': 'replace',
})(webpackConfig, desire(`${__dirname}/webpack.config.preset`));

View File

@@ -1,35 +0,0 @@
'use strict'; // eslint-disable-line
const { default: ImageminPlugin } = require('imagemin-webpack-plugin');
const imageminMozjpeg = require('imagemin-mozjpeg');
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const config = require('./config');
module.exports = {
plugins: [
new ImageminPlugin({
optipng: { optimizationLevel: 2 },
gifsicle: { optimizationLevel: 3 },
pngquant: { quality: '65-90', speed: 4 },
svgo: {
plugins: [
{ removeUnknownsAndDefaults: false },
{ cleanupIDs: false },
{ removeViewBox: false },
],
},
plugins: [imageminMozjpeg({ quality: 75 })],
disable: (config.enabled.watcher),
}),
new UglifyJsPlugin({
uglifyOptions: {
ecma: 5,
compress: {
warnings: true,
drop_console: true,
},
},
}),
],
};

View File

@@ -1,37 +0,0 @@
const url = require('url');
const webpack = require('webpack');
const BrowserSyncPlugin = require('browsersync-webpack-plugin');
const config = require('./config');
const target = process.env.DEVURL || config.devUrl;
/**
* We do this to enable injection over SSL.
*/
if (url.parse(target).protocol === 'https:') {
process.env.NODE_TLS_REJECT_UNAUTHORIZED = 0;
config.proxyUrl = config.proxyUrl.replace('http:', 'https:');
}
module.exports = {
output: {
pathinfo: true,
publicPath: config.proxyUrl + config.publicPath,
},
devtool: '#cheap-module-source-map',
stats: false,
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin(),
new BrowserSyncPlugin({
target,
open: config.open,
proxyUrl: config.proxyUrl,
watch: config.watch,
delay: 500,
}),
],
};

View File

@@ -1,20 +0,0 @@
{
"entry": {
"main": [
"./scripts/main.js",
"./styles/main.scss"
],
"customizer": [
"./scripts/customizer.js"
]
},
"publicPath": "/app/themes/sage",
"devUrl": "http://example.test",
"proxyUrl": "http://localhost:3000",
"cacheBusting": "[name]_[hash:8]",
"watch": [
"app/**/*.php",
"config/**/*.php",
"resources/views/**/*.php"
]
}

View File

@@ -0,0 +1,9 @@
/**
* External Dependencies
*/
import 'jquery';
import 'bootstrap';
$(document).ready(() => {
// console.log('Hello world');
});

View File

@@ -1 +0,0 @@
import 'bootstrap';

View File

@@ -1,5 +1,15 @@
import $ from 'jquery'; /**
* This file allows you to add functionality to the Theme Customizer
* live preview. jQuery is readily available.
*
* {@link https://codex.wordpress.org/Theme_Customization_API}
*/
wp.customize('blogname', (value) => { /**
* Change the blog name value.
*
* @param {string} value
*/
wp.customize('blogname', value => {
value.bind(to => $('.brand').text(to)); value.bind(to => $('.brand').text(to));
}); });

View File

@@ -0,0 +1,15 @@
import '@wordpress/edit-post';
import domReady from '@wordpress/dom-ready';
import {
unregisterBlockStyle,
registerBlockStyle,
} from '@wordpress/blocks';
domReady(() => {
unregisterBlockStyle('core/button', 'outline');
registerBlockStyle('core/button', {
name: 'outline',
label: 'Outline',
});
});

View File

@@ -1,24 +0,0 @@
// import external dependencies
import 'jquery';
// Import everything from autoload
import './autoload/**/*'
// import local dependencies
import Router from './util/Router';
import common from './routes/common';
import home from './routes/home';
import aboutUs from './routes/about';
/** Populate Router instance with DOM routes */
const routes = new Router({
// All pages
common,
// Home page
home,
// About Us page, note the change from about-us to aboutUs.
aboutUs,
});
// Load Events
jQuery(document).ready(() => routes.loadEvents());

View File

@@ -1,5 +0,0 @@
export default {
init() {
// JavaScript to be fired on the about us page
},
};

View File

@@ -1,8 +0,0 @@
export default {
init() {
// JavaScript to be fired on all pages
},
finalize() {
// JavaScript to be fired on all pages, after page specific JS is fired
},
};

View File

@@ -1,8 +0,0 @@
export default {
init() {
// JavaScript to be fired on the home page
},
finalize() {
// JavaScript to be fired on the home page, after the init JS
},
};

View File

@@ -1,71 +0,0 @@
import camelCase from './camelCase';
/**
* DOM-based Routing
*
* Based on {@link http://goo.gl/EUTi53|Markup-based Unobtrusive Comprehensive DOM-ready Execution} by Paul Irish
*
* The routing fires all common scripts, followed by the page specific scripts.
* Add additional events for more control over timing e.g. a finalize event
*/
class Router {
/**
* Create a new Router
* @param {Object} routes
*/
constructor(routes) {
this.routes = routes;
}
/**
* Fire Router events
* @param {string} route DOM-based route derived from body classes (`<body class="...">`)
* @param {string} [event] Events on the route. By default, `init` and `finalize` events are called.
* @param {string} [arg] Any custom argument to be passed to the event.
*/
fire(route, event = 'init', arg) {
document.dispatchEvent(new CustomEvent('routed', {
bubbles: true,
detail: {
route,
fn: event,
},
}));
const fire = route !== '' && this.routes[route] && typeof this.routes[route][event] === 'function';
if (fire) {
this.routes[route][event](arg);
}
}
/**
* Automatically load and fire Router events
*
* Events are fired in the following order:
* * common init
* * page-specific init
* * page-specific finalize
* * common finalize
*/
loadEvents() {
// Fire common init JS
this.fire('common');
// Fire page-specific init JS, and then finalize JS
document.body.className
.toLowerCase()
.replace(/-/g, '_')
.split(/\s+/)
.map(camelCase)
.forEach((className) => {
this.fire(className);
this.fire(className, 'finalize');
});
// Fire common finalize JS
this.fire('common', 'finalize');
}
}
export default Router;

View File

@@ -1,9 +0,0 @@
/**
* the most terrible camelizer on the internet, guaranteed!
* @param {string} str String that isn't camel-case, e.g., CAMeL_CaSEiS-harD
* @return {string} String converted to camel-case, e.g., camelCaseIsHard
*/
export default str => `${str.charAt(0).toLowerCase()}${str.replace(/[\W_]/g, '|').split('|')
.map(part => `${part.charAt(0).toUpperCase()}${part.slice(1)}`)
.join('')
.slice(1)}`;

View File

@@ -0,0 +1,12 @@
/** Config */
@import 'config/variables';
@import 'config/external';
/** Common */
@import 'common/global';
/** Components */
@import 'components';
/** Partials */
@import 'partials/header';

View File

@@ -1 +0,0 @@
@import "~bootstrap/scss/bootstrap";

View File

@@ -1,10 +0,0 @@
/** Import Bootstrap functions */
@import "~bootstrap/scss/functions";
$theme-colors: (
primary: #525ddc
);
/** Bootstrap navbar fix (https://git.io/fADqW) */
$navbar-dark-toggler-icon-bg: none;
$navbar-light-toggler-icon-bg: none;

View File

@@ -0,0 +1,22 @@
/**
* Global
*/
a {
color: map-get($theme-colors, 'primary');
}
/**
* Block editor color palette utilities
* @see https://git.io/JeyD6
*/
@each $color-name, $color-value in $theme-colors {
.has-#{$color-name}-color {
color: $color-value;
}
.has-#{$color-name}-background-color {
background-color: $color-value;
}
}

View File

@@ -1,23 +0,0 @@
.comment-list {
@extend .list-unstyled;
}
.comment-list ol {
list-style: none;
}
.comment-form p {
@extend .form-group;
}
.comment-form input[type="text"],
.comment-form input[type="email"],
.comment-form input[type="url"],
.comment-form textarea {
@extend .form-control;
}
.comment-form input[type="submit"] {
@extend .btn;
@extend .btn-secondary;
}

View File

@@ -1,19 +0,0 @@
/** Search form */
.search-form {
@extend .form-inline;
}
.search-form label {
@extend .form-group;
font-weight: normal;
}
.search-form .search-field {
@extend .form-control;
}
.search-form .search-submit {
@extend .btn;
@extend .btn-secondary;
}

View File

@@ -1,56 +0,0 @@
/**
* WordPress Generated Classes
* @see http://codex.wordpress.org/CSS#WordPress_Generated_Classes
*/
/** Media alignment */
.alignnone {
margin-left: 0;
margin-right: 0;
max-width: 100%;
height: auto;
}
.aligncenter {
display: block;
margin: ($spacer / 2) auto;
height: auto;
}
.alignleft,
.alignright {
margin-bottom: ($spacer / 2);
height: auto;
}
@include media-breakpoint-up(sm) {
.alignleft {
float: left;
margin-right: ($spacer / 2);
}
.alignright {
float: right;
margin-left: ($spacer / 2);
}
}
/** Captions */
.wp-caption {
@extend .figure;
}
.wp-caption img {
@extend .figure-img;
@extend .img-fluid;
}
.wp-caption-text {
@extend .figure-caption;
}
/** Text meant only for screen readers */
.screen-reader-text {
@extend .sr-only;
@extend .sr-only-focusable;
}

View File

@@ -0,0 +1,36 @@
/**
* Button
*/
.wp-block-button {
&__link {
font-size: $btn-font-size;
line-height: $btn-line-height;
padding-bottom: $btn-padding-y;
padding-left: $btn-padding-x;
padding-right: $btn-padding-x;
padding-top: $btn-padding-y;
&:hover {
text-decoration: none;
}
}
&.is-style-outline {
.wp-block-button__link {
@include button-outline-variant(
map-get($theme-colors, 'primary'),
map-get($theme-colors, 'light')
);
}
}
&.is-style-solid {
.wp-block-button__link {
@include button-variant(
map-get($theme-colors, 'primary'),
map-get($theme-colors, 'light')
);
}
}
}

View File

@@ -0,0 +1,5 @@
/**
* Components
*/
@import 'button';

View File

@@ -0,0 +1,5 @@
/**
* External
*/
@import '~bootstrap/scss/bootstrap';

View File

@@ -0,0 +1,7 @@
/**
* Variables
*/
$theme-colors: (
primary: #525ddc,
);

View File

@@ -0,0 +1,16 @@
/**
* Editor
*/
@import 'config/variables';
@import '~bootstrap/scss/functions';
@import '~bootstrap/scss/variables';
@import '~bootstrap/scss/mixins';
.editor-styles-wrapper > * {
@import 'common/global';
@import 'components';
font-family: $font-family-base;
}

View File

@@ -1,7 +0,0 @@
.banner .nav li {
@extend .nav-item;
}
.banner .nav a {
@extend .nav-link;
}

View File

@@ -1,3 +0,0 @@
body#tinymce {
margin: 12px !important;
}

View File

@@ -1,25 +0,0 @@
@import "common/variables";
/** Import everything from autoload */
@import "./autoload/**/*";
/**
* Import npm dependencies
*
* Prefix your imports with `~` to grab from node_modules/
* @see https://github.com/webpack-contrib/sass-loader#imports
*/
// @import "~some-node-module";
/** Import theme styles */
@import "common/global";
@import "components/buttons";
@import "components/comments";
@import "components/forms";
@import "components/wp-classes";
@import "layouts/header";
@import "layouts/sidebar";
@import "layouts/footer";
@import "layouts/pages";
@import "layouts/posts";
@import "layouts/tinymce";

View File

@@ -0,0 +1,7 @@
/**
* Header
*/
.brand {
font-weight: bold;
}

View File

@@ -1,92 +0,0 @@
<?php
/**
* Do not edit anything in this file unless you know what you're doing
*/
use Roots\Sage\Config;
use Roots\Sage\Container;
/**
* Helper function for prettying up errors
* @param string $message
* @param string $subtitle
* @param string $title
*/
$sage_error = function ($message, $subtitle = '', $title = '') {
$title = $title ?: __('Sage &rsaquo; Error', 'sage');
$footer = '<a href="https://roots.io/sage/docs/">roots.io/sage/docs/</a>';
$message = "<h1>{$title}<br><small>{$subtitle}</small></h1><p>{$message}</p><p>{$footer}</p>";
wp_die($message, $title);
};
/**
* Ensure compatible version of PHP is used
*/
if (version_compare('7.1', phpversion(), '>=')) {
$sage_error(__('You must be using PHP 7.1 or greater.', 'sage'), __('Invalid PHP version', 'sage'));
}
/**
* Ensure compatible version of WordPress is used
*/
if (version_compare('4.7.0', get_bloginfo('version'), '>=')) {
$sage_error(__('You must be using WordPress 4.7.0 or greater.', 'sage'), __('Invalid WordPress version', 'sage'));
}
/**
* Ensure dependencies are loaded
*/
if (!class_exists('Roots\\Sage\\Container')) {
if (!file_exists($composer = __DIR__.'/../vendor/autoload.php')) {
$sage_error(
__('You must run <code>composer install</code> from the Sage directory.', 'sage'),
__('Autoloader not found.', 'sage')
);
}
require_once $composer;
}
/**
* Sage required files
*
* The mapped array determines the code library included in your theme.
* Add or remove files to the array as needed. Supports child theme overrides.
*/
array_map(function ($file) use ($sage_error) {
$file = "../app/{$file}.php";
if (!locate_template($file, true, true)) {
$sage_error(sprintf(__('Error locating <code>%s</code> for inclusion.', 'sage'), $file), 'File not found');
}
}, ['helpers', 'setup', 'filters', 'admin']);
/**
* Here's what's happening with these hooks:
* 1. WordPress initially detects theme in themes/sage/resources
* 2. Upon activation, we tell WordPress that the theme is actually in themes/sage/resources/views
* 3. When we call get_template_directory() or get_template_directory_uri(), we point it back to themes/sage/resources
*
* We do this so that the Template Hierarchy will look in themes/sage/resources/views for core WordPress themes
* But functions.php, style.css, and index.php are all still located in themes/sage/resources
*
* This is not compatible with the WordPress Customizer theme preview prior to theme activation
*
* get_template_directory() -> /srv/www/example.com/current/web/app/themes/sage/resources
* get_stylesheet_directory() -> /srv/www/example.com/current/web/app/themes/sage/resources
* locate_template()
* ├── STYLESHEETPATH -> /srv/www/example.com/current/web/app/themes/sage/resources/views
* └── TEMPLATEPATH -> /srv/www/example.com/current/web/app/themes/sage/resources
*/
array_map(
'add_filter',
['theme_file_path', 'theme_file_uri', 'parent_theme_file_path', 'parent_theme_file_uri'],
array_fill(0, 4, 'dirname')
);
Container::getInstance()
->bindIf('config', function () {
return new Config([
'assets' => require dirname(__DIR__).'/config/assets.php',
'theme' => require dirname(__DIR__).'/config/theme.php',
'view' => require dirname(__DIR__).'/config/view.php',
]);
}, true);

View File

@@ -1,3 +0,0 @@
<?php
// this file is deliberately blank

View File

@@ -3,10 +3,11 @@
@section('content') @section('content')
@include('partials.page-header') @include('partials.page-header')
@if (!have_posts()) @if (! have_posts())
<div class="alert alert-warning"> <x-alert type="warning">
{{ __('Sorry, but the page you were trying to view does not exist.', 'sage') }} {!! __('Sorry, but the page you are trying to view does not exist.', 'sage') !!}
</div> </x-alert>
{!! get_search_form(false) !!} {!! get_search_form(false) !!}
@endif @endif
@endsection @endsection

View File

@@ -0,0 +1,3 @@
<div class="alert alert-{{ $type }}">
{!! $message ?? $slot !!}
</div>

View File

@@ -0,0 +1,8 @@
<form role="search" method="get" class="search-form" action="{{ home_url('/') }}">
<label>
<span class="screen-reader-text">{{ _x('Search for:', 'label', 'sage') }}</span>
<input type="search" class="search-field" placeholder="{!! esc_attr_x('Search &hellip;', 'placeholder', 'sage') !!}" value="{{ get_search_query() }}" name="s">
</label>
<input type="submit" class="button" value="{{ esc_attr_x('Search', 'submit button', 'sage') }}">
</form>

View File

@@ -3,16 +3,21 @@
@section('content') @section('content')
@include('partials.page-header') @include('partials.page-header')
@if (!have_posts()) @if (! have_posts())
<div class="alert alert-warning"> <x-alert type="warning">
{{ __('Sorry, no results were found.', 'sage') }} {!! __('Sorry, no results were found.', 'sage') !!}
</div> </x-alert>
{!! get_search_form(false) !!} {!! get_search_form(false) !!}
@endif @endif
@while (have_posts()) @php the_post() @endphp @while(have_posts()) @php(the_post())
@include('partials.content-'.get_post_type()) @includeFirst(['partials.content-' . get_post_type(), 'partials.content'])
@endwhile @endwhile
{!! get_the_posts_navigation() !!} {!! get_the_posts_navigation() !!}
@endsection @endsection
@section('sidebar')
@include('partials.sidebar')
@endsection

View File

@@ -1,23 +1,15 @@
<!doctype html> @include('partials.header')
<html {!! get_language_attributes() !!}>
@include('partials.head') <div class="container">
<body @php body_class() @endphp> <main class="main">
@php do_action('get_header') @endphp @yield('content')
@include('partials.header') </main>
<div class="wrap container" role="document">
<div class="content"> @hasSection('sidebar')
<main class="main"> <aside class="sidebar">
@yield('content') @yield('sidebar')
</main> </aside>
@if (App\display_sidebar()) @endif
<aside class="sidebar"> </div>
@include('partials.sidebar')
</aside> @include('partials.footer')
@endif
</div>
</div>
@php do_action('get_footer') @endphp
@include('partials.footer')
@php wp_footer() @endphp
</body>
</html>

View File

@@ -1,8 +1,8 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
@while(have_posts()) @php the_post() @endphp @while(have_posts()) @php(the_post())
@include('partials.page-header') @include('partials.page-header')
@include('partials.content-page') @includeFirst(['partials.content-page', 'partials.content'])
@endwhile @endwhile
@endsection @endsection

View File

@@ -1,38 +1,39 @@
@php @if (! post_password_required())
if (post_password_required()) { <section id="comments" class="comments">
return; @if (have_comments())
} <h2>
@endphp {!! sprintf(_nx('One response to &ldquo;%2$s&rdquo;', '%1$s responses to &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'sage'), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>') !!}
</h2>
<section id="comments" class="comments"> <ol class="comment-list">
@if (have_comments()) {!! wp_list_comments(['style' => 'ol', 'short_ping' => true]) !!}
<h2> </ol>
{!! sprintf(_nx('One response to &ldquo;%2$s&rdquo;', '%1$s responses to &ldquo;%2$s&rdquo;', get_comments_number(), 'comments title', 'sage'), number_format_i18n(get_comments_number()), '<span>' . get_the_title() . '</span>') !!}
</h2>
<ol class="comment-list"> @if (get_comment_pages_count() > 1 && get_option('page_comments'))
{!! wp_list_comments(['style' => 'ol', 'short_ping' => true]) !!} <nav>
</ol> <ul class="pager">
@if (get_previous_comments_link())
<li class="previous">
{!! get_previous_comments_link(__('&larr; Older comments', 'sage')) !!}
</li>
@endif
@if (get_comment_pages_count() > 1 && get_option('page_comments')) @if (get_next_comments_link())
<nav> <li class="next">
<ul class="pager"> {!! get_next_comments_link(__('Newer comments &rarr;', 'sage')) !!}
@if (get_previous_comments_link()) </li>
<li class="previous">@php previous_comments_link(__('&larr; Older comments', 'sage')) @endphp</li> @endif
@endif </ul>
@if (get_next_comments_link()) </nav>
<li class="next">@php next_comments_link(__('Newer comments &rarr;', 'sage')) @endphp</li> @endif
@endif
</ul>
</nav>
@endif @endif
@endif
@if (!comments_open() && get_comments_number() != '0' && post_type_supports(get_post_type(), 'comments')) @if (! comments_open() && get_comments_number() != '0' && post_type_supports(get_post_type(), 'comments'))
<div class="alert alert-warning"> <x-alert type="warning">
{{ __('Comments are closed.', 'sage') }} {!! __('Comments are closed.', 'sage') !!}
</div> </x-alert>
@endif @endif
@php comment_form() @endphp @php(comment_form())
</section> </section>
@endif

View File

@@ -1,2 +1,2 @@
@php the_content() @endphp @php(the_content())
{!! wp_link_pages(['echo' => 0, 'before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']) !!} {!! wp_link_pages(['echo' => 0, 'before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']) !!}

View File

@@ -1,11 +1,15 @@
<article @php post_class() @endphp> <article @php(post_class())>
<header> <header>
<h2 class="entry-title"><a href="{{ get_permalink() }}">{!! get_the_title() !!}</a></h2> <h2 class="entry-title">
@if (get_post_type() === 'post') <a href="{{ get_permalink() }}">
@include('partials/entry-meta') {!! $title !!}
@endif </a>
</h2>
@includeWhen(get_post_type() === 'post', 'partials/entry-meta')
</header> </header>
<div class="entry-summary"> <div class="entry-summary">
@php the_excerpt() @endphp @php(the_excerpt())
</div> </div>
</article> </article>

View File

@@ -1,13 +1,19 @@
<article @php post_class() @endphp> <article @php(post_class())>
<header> <header>
<h1 class="entry-title">{!! get_the_title() !!}</h1> <h1 class="entry-title">
{!! $title !!}
</h1>
@include('partials/entry-meta') @include('partials/entry-meta')
</header> </header>
<div class="entry-content"> <div class="entry-content">
@php the_content() @endphp @php(the_content())
</div> </div>
<footer> <footer>
{!! wp_link_pages(['echo' => 0, 'before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']) !!} {!! wp_link_pages(['echo' => 0, 'before' => '<nav class="page-nav"><p>' . __('Pages:', 'sage'), 'after' => '</p></nav>']) !!}
</footer> </footer>
@php comments_template('/partials/comments.blade.php') @endphp
@php(comments_template())
</article> </article>

View File

@@ -1,9 +1,15 @@
<article @php post_class() @endphp> <article @php(post_class())>
<header> <header>
<h2 class="entry-title"><a href="{{ get_permalink() }}">{!! get_the_title() !!}</a></h2> <h2 class="entry-title">
<a href="{{ get_permalink() }}">
{!! $title !!}
</a>
</h2>
@include('partials/entry-meta') @include('partials/entry-meta')
</header> </header>
<div class="entry-summary"> <div class="entry-summary">
@php the_excerpt() @endphp @php(the_excerpt())
</div> </div>
</article> </article>

View File

@@ -1,6 +1,10 @@
<time class="updated" datetime="{{ get_post_time('c', true) }}">{{ get_the_date() }}</time> <time class="updated" datetime="{{ get_post_time('c', true) }}">
{{ get_the_date() }}
</time>
<p class="byline author vcard"> <p class="byline author vcard">
{{ __('By', 'sage') }} <a href="{{ get_author_posts_url(get_the_author_meta('ID')) }}" rel="author" class="fn"> <span>{{ __('By', 'sage') }}</span>
<a href="{{ get_author_posts_url(get_the_author_meta('ID')) }}" rel="author" class="fn">
{{ get_the_author() }} {{ get_the_author() }}
</a> </a>
</p> </p>

View File

@@ -1,5 +1,5 @@
<footer class="content-info"> <footer class="content-info">
<div class="container"> <div class="container">
@php dynamic_sidebar('sidebar-footer') @endphp @php(dynamic_sidebar('sidebar-footer'))
</div> </div>
</footer> </footer>

View File

@@ -1,6 +0,0 @@
<head>
<meta charset="utf-8">
<meta http-equiv="x-ua-compatible" content="ie=edge">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
@php wp_head() @endphp
</head>

View File

@@ -1,9 +1,12 @@
<header class="banner"> <header class="banner">
<div class="container"> <div class="container">
<a class="brand" href="{{ home_url('/') }}">{{ get_bloginfo('name', 'display') }}</a> <a class="brand" href="{{ home_url('/') }}">
{{ $siteName }}
</a>
<nav class="nav-primary"> <nav class="nav-primary">
@if (has_nav_menu('primary_navigation')) @if (has_nav_menu('primary_navigation'))
{!! wp_nav_menu(['theme_location' => 'primary_navigation', 'menu_class' => 'nav']) !!} {!! wp_nav_menu(['theme_location' => 'primary_navigation', 'menu_class' => 'nav', 'echo' => false]) !!}
@endif @endif
</nav> </nav>
</div> </div>

View File

@@ -1,3 +1,3 @@
<div class="page-header"> <div class="page-header">
<h1>{!! App::title() !!}</h1> <h1>{!! $title !!}</h1>
</div> </div>

View File

@@ -1 +1 @@
@php dynamic_sidebar('sidebar-primary') @endphp @php(dynamic_sidebar('sidebar-primary'))

View File

@@ -3,14 +3,15 @@
@section('content') @section('content')
@include('partials.page-header') @include('partials.page-header')
@if (!have_posts()) @if (! have_posts())
<div class="alert alert-warning"> <x-alert type="warning">
{{ __('Sorry, no results were found.', 'sage') }} {!! __('Sorry, no results were found.', 'sage') !!}
</div> </x-alert>
{!! get_search_form(false) !!} {!! get_search_form(false) !!}
@endif @endif
@while(have_posts()) @php the_post() @endphp @while(have_posts()) @php(the_post())
@include('partials.content-search') @include('partials.content-search')
@endwhile @endwhile

View File

@@ -1,7 +1,7 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
@while(have_posts()) @php the_post() @endphp @while(have_posts()) @php(the_post())
@include('partials.content-single-'.get_post_type()) @includeFirst(['partials.content-single-' . get_post_type(), 'partials.content-single'])
@endwhile @endwhile
@endsection @endsection

View File

@@ -5,7 +5,7 @@
@extends('layouts.app') @extends('layouts.app')
@section('content') @section('content')
@while(have_posts()) @php the_post() @endphp @while(have_posts()) @php(the_post())
@include('partials.page-header') @include('partials.page-header')
@include('partials.content-page') @include('partials.content-page')
@endwhile @endwhile

View File

Before

Width:  |  Height:  |  Size: 225 B

After

Width:  |  Height:  |  Size: 225 B

Some files were not shown because too many files have changed in this diff Show More