Browse Source

Move style.css to theme root (fix #24) (#25)

* Move style.css to theme root (fix #24).
* Fix coding standards.
pull/11/merge
Ned Zimmerman 7 years ago committed by GitHub
parent
commit
a3037c6e4c
  1. 8
      README.md
  2. 7
      app/filters.php
  3. 15
      functions.php
  4. 0
      index.php
  5. 4
      phpcs.xml
  6. 0
      screenshot.png
  7. 0
      style.css

8
README.md

@ -43,6 +43,8 @@ themes/pressbooks-aldine/ # → Theme root
├── composer.json # → Autoloading for `app/` files
├── composer.lock # → Composer lock file (never edit)
├── dist/ # → Built theme assets (never edit)
├── functions.php # → Composer autoloader, theme includes
├── index.php # → Never manually edit
├── node_modules/ # → Node.js packages (never edit)
├── package.json # → Node.js dependencies and scripts
├── resources/ # → Theme assets and templates
@ -53,13 +55,11 @@ themes/pressbooks-aldine/ # → Theme root
│ │ ├── images/ # → Theme images
│ │ ├── scripts/ # → Theme JS
│ │ └── 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
│ ├── layouts/ # → Base templates
│ └── partials/ # → Partial templates
├── screenshot.png # → Theme screenshot for WP admin
├── style.css # → Theme meta information
└── vendor/ # → Composer packages (never edit)
```

7
app/filters.php

@ -64,6 +64,13 @@ add_filter('comments_template', function ($comments_template) {
return template_path(locate_template(["views/{$comments_template}", $comments_template]) ?: $comments_template);
});
/**
* Fix Controller path
*/
add_filter('sober/controller/path', function () {
return get_template_directory() . '/app/controllers';
});
/**
* Remove Admin Bar callback
*/

15
resources/functions.php → functions.php

@ -41,7 +41,7 @@ if (version_compare('4.7.0', get_bloginfo('version'), '>=')) {
* Ensure dependencies are loaded
*/
if (!class_exists('Roots\\Sage\\Container')) {
if (!file_exists($composer = __DIR__.'/../vendor/autoload.php')) {
if (!file_exists($composer = __DIR__.'/vendor/autoload.php')) {
$sage_error(
__('You must run <code>composer install</code> from the Sage directory.', 'aldine'),
__('Autoloader not found.', 'aldine')
@ -57,7 +57,7 @@ if (!class_exists('Roots\\Sage\\Container')) {
* Add or remove files to the array as needed. Supports child theme overrides.
*/
array_map(function ($file) use ($sage_error) {
$file = "../app/{$file}.php";
$file = "/app/{$file}.php";
if (!locate_template($file, true, true)) {
$sage_error(sprintf(__('Error locating <code>%s</code> for inclusion.', 'aldine'), $file), 'File not found');
}
@ -87,16 +87,11 @@ array_map(function ($file) use ($sage_error) {
* ├── 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',
'assets' => require __DIR__.'/config/assets.php',
'theme' => require __DIR__.'/config/theme.php',
'view' => require __DIR__.'/config/view.php',
]);
}, true);

0
resources/index.php → index.php

4
phpcs.xml

@ -3,8 +3,8 @@
<description>Roots Coding Standards</description>
<!-- Scan these files -->
<file>resources/functions.php</file>
<file>resources/index.php</file>
<file>functions.php</file>
<file>index.php</file>
<file>app</file>
<file>resources/views</file>

0
resources/screenshot.png → screenshot.png

Before

Width:  |  Height:  |  Size: 2.2 MiB

After

Width:  |  Height:  |  Size: 2.2 MiB

0
resources/style.css → style.css

Loading…
Cancel
Save