Skip to content

Commit

Permalink
really remove headless
Browse files Browse the repository at this point in the history
  • Loading branch information
Sidstumple committed Oct 9, 2024
1 parent 6fdf988 commit 1431545
Show file tree
Hide file tree
Showing 18 changed files with 40 additions and 138 deletions.
1 change: 0 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ jobs:
- name: npm run try
run: |
npm ci
npm run try:headless
npm run try:normal
env:
CI: true
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
Make sure you have [npx](https://www.npmjs.com/package/npx) installed (`npx` is shipped by default since NPM `5.2.0`)

```bash
npx automatise-wordpress <my-project>
npx automatise-wordpress@latest <my-project>
```

## Credits
Expand All @@ -22,7 +22,7 @@ npx automatise-wordpress <my-project>

This project is set up to work with Local by Flywheel

## Updating
## Updating this package:
```bash
npm version patch -m "Upgrade to %s; "
```
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 4 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
"type": "git"
},
"scripts": {
"try:headless": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\",\"wordpressType\":\"headless\"}'",
"try:normal": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\",\"wordpressType\":\"normal\"}'",
"try:smoothscroll": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\",\"wordpressType\":\"normal\",\"smoothscroll\":true}'",
"try:three": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\",\"wordpressType\":\"normal\",\"smoothscroll\":true,\"three\":true}'",
"try:local": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\",\"extension\":\"local\",\"wordpressType\":\"normal\",\"smoothscroll\":true,\"three\":false}'",
"try:normal": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\"}'",
"try:smoothscroll": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\",\"smoothscroll\":true}'",
"try:three": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\",\"smoothscroll\":true,\"three\":true}'",
"try:local": "rm -rf fissa && node cli.js fissa '{\"packageName\":\"fissa\",\"name\":\"fissa\",\"description\":\"fissa\",\"author\":\"fissa\",\"smoothscroll\":true,\"three\":false}'",
"trypublish": "npm publish || true"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion template/config/dev.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
url: 'https://<%= packageName %>.<%= extension %>',
url: 'https://<%= packageName %>.local',
mode: 'development',
themeName: '<%= packageName %>',
publicPath: '/wp-content/themes/<%= packageName %>/assets/',
Expand Down
6 changes: 1 addition & 5 deletions template/src/404.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@
* @version 1.0
* @since 1.0
*/
<% if (wordpressType === 'headless') { %>
$uri = $_SERVER['REQUEST_URI'];
wp_redirect('https://' . FRONTEND_DOMAIN . $uri, 301);
exit();
<% } %>

get_header();
get_footer();
7 changes: 2 additions & 5 deletions template/src/assets/scss/app.scss
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
// Theme
@import 'typography/typography';
@import 'components/index';
<% if(wordpressType === 'normal') { %>
@import '~matise-gryd/gryd-once.scss';
<% } else { %>
// @import '~matise-gryd/gryd-once.scss'; We don't include this one yet, only if we need to
<% } %>

<% if (smoothscroll == 'true') { %>
@import 'scroll';
<% } %>
<% } %>
5 changes: 2 additions & 3 deletions template/src/assets/scss/typography/_usage.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<% if(wordpressType === 'normal') { %>

h1,
h2,
h3,
Expand All @@ -20,5 +20,4 @@ h1 {
line-height: 1;
@include min-('font-size', 2, 24);
@include max-('font-size', 2, 240);
}
<% } %>
}
2 changes: 0 additions & 2 deletions template/src/footer.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,9 @@
<% } else { %>
</main>
<% } %>
<% if (wordpressType === 'normal') { %>
<?php $footer_menu = get_menu_items_by_registered_slug( 'footer_menu' ); // if you rename your footer menu you'll need to rename this one as well ?>

<footer class="footer"></footer>
<% } %>

<?php wp_footer(); ?>
</body>
Expand Down
5 changes: 1 addition & 4 deletions template/src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,8 @@ function theme_scripts() {
wp_enqueue_style('theme-css', $include_url.'/assets/main.css', array(), date("is"), false);
wp_enqueue_script('theme-appjs', get_theme_file_uri( '/assets/main.js' ), array(), date("is"), true );
}
<% if (wordpressType === 'normal') { %>
add_action( 'wp_enqueue_scripts', 'theme_scripts' );
<% } else { %>
add_action( 'admin_enqueue_scripts', 'theme_scripts' );
<% } %>

//===================
// Includes folder includes
//===================
Expand Down
48 changes: 23 additions & 25 deletions template/src/header.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,31 +22,29 @@
<?php wp_head();?>
</head>
<body <?php body_class(); ?>>
<% if (wordpressType === 'normal') { %>
<?php $header_menu = get_menu_items_by_registered_slug( 'header_menu' ); // change 'header_menu' if you changed the menu location name ?>
<header class="header">
<div class="header__inner">
<nav class="nav nav--top" aria-label="Top navigation">
<ul class="nav__list">
<?php if ($header_menu) : ?>
<?php foreach ($header_menu as $item) : ?>
<?php
$target = $item->target ? 'target="_blank" rel="noopener"' : '';
?>
<li class="nav__item">
<div class="nav__text-container">
<a class="nav__link" href="<?= $item->url ?>" <?=$target;?>>
<span class="nav__text"><?= $item->title ?></span>
</a>
</div>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</nav>
</div>
</header>
<% } %>
<?php $header_menu = get_menu_items_by_registered_slug( 'header_menu' ); // change 'header_menu' if you changed the menu location name ?>
<header class="header">
<div class="header__inner">
<nav class="nav nav--top" aria-label="Top navigation">
<ul class="nav__list">
<?php if ($header_menu) : ?>
<?php foreach ($header_menu as $item) : ?>
<?php
$target = $item->target ? 'target="_blank" rel="noopener"' : '';
?>
<li class="nav__item">
<div class="nav__text-container">
<a class="nav__link" href="<?= $item->url ?>" <?=$target;?>>
<span class="nav__text"><?= $item->title ?></span>
</a>
</div>
</li>
<?php endforeach; ?>
<?php endif; ?>
</ul>
</nav>
</div>
</header>
<% if (smoothscroll == 'true') { %>
<div data-scroll-wrapper data-scroll-content class="smooth-scroll" data-router-wrapper>
<main id="main" class="app-transition-fade" data-router-view="page" data-scroll-container>
Expand Down
9 changes: 0 additions & 9 deletions template/src/includes/includes.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,7 @@
//===================
require_once('settings/index.php');

<% if (wordpressType === 'headless') { %>
//===================
// WP Core
//===================
require_once('wp-core/init.php');
<% } %>

<% if (wordpressType === 'normal') { %>
//===================
// Components and partials
//===================
require_once('svgs/generate.php');
<% } %>
5 changes: 1 addition & 4 deletions template/src/includes/settings/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,4 @@
require_once('acf.php');
require_once('image.php');
require_once('menu-settings.php');
require_once('theme.php');
<% if (wordpressType === 'headless') { %>
require_once('url.php');
<% } %>
require_once('theme.php');
46 changes: 0 additions & 46 deletions template/src/includes/settings/url.php

This file was deleted.

7 changes: 1 addition & 6 deletions template/src/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,7 @@
* @version 1.0
* @since 1.0
*/
<% if (wordpressType === 'headless') { %>
$uri = $_SERVER['REQUEST_URI'];
wp_redirect('https://' . FRONTEND_DOMAIN . $uri, 301);
exit();
<% } else { %>

get_header();
the_post();
the_content();
Expand All @@ -36,4 +32,3 @@
</section>
<?php
get_footer();
<% } %>
6 changes: 0 additions & 6 deletions template/src/page-home.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,10 @@
* Template Name: Home Template
*/

<% if (wordpressType === 'headless') { %>
$uri = $_SERVER['REQUEST_URI'];
wp_redirect('https://' . FRONTEND_DOMAIN . $uri, 301);
exit();
<% } else { %>
get_header();
the_post();
the_title();
the_content();
get_footer();
<% } %>

?>
9 changes: 2 additions & 7 deletions template/src/page.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,9 @@
* @version 1.0
* @since 1.0
*/
<% if (wordpressType === 'headless') { %>
$uri = $_SERVER['REQUEST_URI'];
wp_redirect('https://' . FRONTEND_DOMAIN . $uri, 301);
exit();
<% } else { %>

get_header();
the_post();
the_title();
the_content();
get_footer();
<% } %>
get_footer();
6 changes: 0 additions & 6 deletions template/src/single.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,8 @@
* @version 1.0
* @since 1.0
*/
<% if (wordpressType === 'headless') { %>
$uri = $_SERVER['REQUEST_URI'];
wp_redirect('https://' . FRONTEND_DOMAIN . $uri, 301);
exit();
<% } else { %>
get_header();
the_post();
the_title();
the_content();
get_footer();
<% } %>

0 comments on commit 1431545

Please sign in to comment.