Giter Club home page Giter Club logo

theme-scaffold's Introduction

10up Scaffold

DEPRECATED. Use https://github.com/10up/wp-scaffold

At 10up, we strive to provide digital products that yield a top-notch user experience. In order to improve both our efficiency and consistency, we need to standardize what we use and how we use it. This theme scaffold allows us to share initial set up procedures to make sure all projects can get up and running as quickly as possible while closely adhering to 10up's high quality standards.

Support Level MIT License

Dependencies

  1. Node@^8.11.0 & NPM - Build packages and 3rd party dependencies are managed through NPM, so you will need that installed globally.
  2. Webpack - Webpack is used to process the JavaScript, CSS, and other assets.
  3. Composer - Composer is used to manage PHP.

Getting Started

Quick Start

Install 10up's command line tool for scaffolding new projects. You can download it from the Project Scaffold repository. Setting up a new theme is as easy as running create-10up theme theme-name-here in the terminal!

Browsersync requires a local development URL. This is currently set in the config/webpack.settings.js, as BrowserSyncConfig.proxy.

Direct Install

  • Clone the repository
  • Rename folder theme-scaffold -> your project's name
  • If copying files manually to an existing theme directory instead of cloning directly from the repository, make sure to include the following files which may be hidden:
.babelrc
.browserslistrc
.editorconfig
.eslintignore
.eslintrc
.gitignore

The NPM commands will fail without these files present.

  • Do case-sensitive search/replace for the following:

    • TenUpScaffold
    • TENUP_SCAFFOLD
    • tenup-scaffold
    • tenup_scaffold
    • 10up Scaffold
  • cd into the theme folder

  • run npm run start

Webpack config

Webpack config files can be found in config folder:

  • webpack.config.dev.js
  • webpack.config.common.js
  • webpack.config.prod.js
  • webpack.settings.js

In most cases webpack.settings.js is the main file which would change from project to project. For example adding or removing entry points for JS and CSS.

NPM Commands

  • npm run start (install dependencies)
  • npm run watch (watch)
  • npm run build (build all files)
  • npm run build-release (build all files for release)
  • npm run dev (build all files for development)
  • npm run lint-release (install dependencies and run linting)
  • npm run lint-css (lint CSS)
  • npm run lint-js (lint JS)
  • npm run lint-php (lint PHP)
  • npm run lint (run all lints)
  • npm run format-js (format JS using eslint)
  • npm run format (alias for npm run format-js)
  • npm run test:a11y (run accessibility tests)

Composer Commands

  • composer install* (install packages)
  • composer update* (update packages)
  • composer lint (lint PHP files)
  • composer lint-fix (lint PHP files and automatically correct coding standard violations)

* If your host machine's local version of PHP is <7.2, composer may produce the following, or similar, error message:

 Problem 1
    - Installation request for 10up/wpacceptance dev-master -> satisfiable by 10up/wpacceptance[dev-master].
    - 10up/wpacceptance dev-master requires php >=7.2 -> your PHP version (7.1.23) does not satisfy that requirement

To suppress this error, add the flag --ignore-platform-reqs (ie. composer install --ignore-platform-reqs).

Automated Style Guide

The Theme Scaffolding ships with a default style guide you can find in /templates/page-styleguide.php. This file contains all the basic HTML elements you would find at the very top of the cascade (headings, typography, tables, forms, etc.) These base elements will be styled and displayed as you naturally build out your CSS. The style guide also automatically pulls in the color variables used in the project. Any hex codes added into /assets/css/frontend/global/variables.css will be automatically displayed in the style guide. To set up your style guide, you just need to create a new page in WordPress and assign it the "Style Guide" template.

If you need to update the core styles that power the style guide they are located in /assets/css/styleguide and will naturally process with the rest of the CSS.

As your site grows you can add components to the style guide by updating /templates/page-styleguide.php as you see fit. All the JS and CSS for the site will already be included in the template, so everything should just work.

Automated Accessibility Testing

Automated accessibility testing in the Theme Scaffolding is done with Pa11y and is executed with the command npm run test-a11y. You can find any configuration options inside your package.json file inside the testing object. You will see default URL options (homepage, article, search-results), but you can add as many as you'd like. The default script runs over the local URL and any others will run with an argument like npm run test-a11y production, over a production URL. You can also add more template URLs for testing like npm run a11y-test article-template. Be sure to check with your systems person on a project to make sure accessibility tests are also hooked up through the deploy process.

Compliance levels can also be updated through the testing.accessibility.compliance object in the package.json file. The default is WCAG Level A, but it can be updated to anything listed in the pa11y documentation.

The test file lives in /tests/accessibility/compliance/pa11y.js if any edits are needed (such as staging credentials, if you're running tests in an environment that requires authentication).

Visual Regression Testing

We use BackstopJS to run our visual regression tests. BackstopJS requires just a few settings to work: a scenarios array that tells it which URL's to screenshot, a viewports array that tells it what breakpoints to use, and a config object for global settings.

Begin by setting which URL's you'd like to test in the testing.urls object in package.json. You will see some default URL's (homepage, article, search-results), but you can add as many as you'd like. These URL's are read by tests/visual/scenarios.js to automatically produce the scenarios array that BackstopJS will use to take screenshots.

You can also create custom scenarios in tests/visual/custom-scenarios.js. Custom scenarios allow us to add specific options for specific URL's, for situations like hovering over an element to screenshot its hover state, or clicking a modal button and waiting for the modal to become visible.

To create a custom scenario, simply set the urlName property to match the property name in the testing.urls object, and then create an options object with your desired settings. A couple examples are provided in tests/visual/custom-scenarios.js and you can see a list of all available options in the advanced scenarios section on GitHub.

BackstopJS can take screenshots at various screen widths, so make sure to match the breakpoints in tests/visual/viewports.js with those in your theme.

Though generally not necessary, you can customize the BackstopJS configuration by changing the settings in tests/visual/config.js.

To begin running BackstopJS visual regression tests, initialize its required files. This only needs to be done once on your local machine:

npm run test:visual-init

Then create a set of screenshots that will become the base reference images to run future tests against:

npm run test:visual-reference

After you've made changes and want to test for visual regressions:

npm run test:visual

Finally, if the new screenshots fail but contain desired changes, approve them for use as the new base reference images:

npm run test:visual-approve

Automated Acceptance Testing

Automated acceptance testing in the Theme Scaffolding leverages WP Acceptance and is included in the project via Composer as a dev required package. Run the command composer update (see Composer Commands above) to install the required packages. Refer to the documentation to ensure your host machine has the necessary requirements. The Theme Scaffolding is already setup to work with WP Acceptance and a few example tests have been created to serve as examples.

To run the test suite, from the root of the repository, run ./vendor/bin/wpacceptance run. WP Acceptance will automatically run the test suite in isolated docker containers. To write your own acceptance tests, refer to the documentation and cookbook.

Contributing

We don't know everything! We welcome pull requests and spirited, but respectful, debates. Please contribute via pull requests on GitHub.

  1. Fork it!
  2. Create your feature branch: git checkout -b feature/my-new-feature
  3. Commit your changes: git commit -am 'Added some great feature!'
  4. Push to the branch: git push origin feature/my-new-feature
  5. Submit a pull request

Learn more about the default packages used with this project

Support Level

Active: 10up is actively working on this, and we expect to continue work for the foreseeable future including keeping tested up to the most recent version of WordPress. Bug reports, feature requests, questions, and pull requests are welcome.

Like what you see?

Work with 10up, we create amazing websites and tools that make content management simple and fun using open source tools and platforms

theme-scaffold's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

theme-scaffold's Issues

Feature: ES5 and ES6 Code Bundles

With Webpack, it should be possible to split up our JS code into two separate files, one ES5 and one ES6. Assuming the majority of 10up will write their code in ES6 anyways to take advantage of the new features it brings, we can make it so we deliver an appropriate package and more performant JS to ES6 capable browsers. ES6 browsers will benefit by having both smaller payload (and hence load time), as well as faster execution. ES5 browsers will continue to get the experience they do now.

This approach was shared in our Slack chat some time ago (https://10up.slack.com/archives/G11CA43FW/p1534367275000100), but the article that outlines the approach is: https://philipwalton.com/articles/deploying-es2015-code-in-production-today/

Lint Warning in `includes/core.php`

FILE: ...fault\public_html\wp-content\themes\eats-theme\includes\core.php

FOUND 0 ERRORS AND 1 WARNING AFFECTING 1 LINE

121 | WARNING | This comment is 75% valid code; is this commented
| | out code?

There is a _doing_it_wrong()? comment in the script_loader_tag function.

Solutions:
Not necessarily a big issue, but can be annoying. The comment could either ignore the rule for this particular line. Alternatively revising the comment text, or removing it completely would also work. It is not fully clear what the comments are indicating.

Add Default WP Files

We can probably safely add basic stuff like: front-page.php, page.php, and single.php into the scaffolding. Thoughts? @daveross @magnificode

I'd also like to add a default template for a styleguide in /templates/page-styleguide.php with a default layout and initial HTML/hooks. We have some functions that will automatically pull in the colors and such to semi-automate the barebones styleguide for a project.

Storybook Addition

With Vue and React becoming more prominent in our workflow.
Could we perhaps incorporate storybooks into our theme scaffolding?

There are quite a few benefits having it:

  • A visual library of all UI components that are available on the project.
  • ( Helps any on coming engineers to know what components are pre-built and what the possible restraint of each component might have )
  • Will help give LOE to existing components.
  • Will force Engineers to build components as pure stand-alone components. Forcing the correct use of props.
  • There are useful Addons, one being Accessablity Testing among others.

Add Theme Thumbnail Image

The current theme doesn't have a default thumbnail and it's weird. Create a PNG image that’s 880 pixels wide x 660 pixels tall. Save that image as screenshot.png. Probably use the 10up logo with a white background.

Add wordpress.css to base folder

Thoughts on including wordpress.css within base folder to include standard WordPress generated classes? Few that I can think of that every project should include are alignments(.alignleft, .alignright, .aligncenter, etc) and images(.wp-caption, .wp-caption-text). I find my self adding this on just about every project and I usually see this file in just about all other project.

I can work on a PR for this.

Feature: Integrate gulp-notify

gulp-notify

Send messages to Mac Notification Center, Linux notifications (using notify-send) or Windows >= 8 (using native toaster) or Growl as fallback, using the node-notifier module. Can also specify custom notifier.

Use case: how many times have you been dev’ing (npm run watch) along only to realize there are errors in the console and things stopped compiling? Why not get a friendly and helpful notification instead?

Feature: replace LiveReload with Browsersync

Browsersync

Browsersync has more features, like:

  • Interaction Sync - Your scroll, click, refresh and form actions are mirrored between browsers while you test.
  • Network Throttle - Test your website against a slower connection. Even when devices are connected to wifi.
  • File Sync - Browsers are automatically updated as you change HTML, CSS, images and other project files.

Warning for empty css files

style.css is importing empty files and postcss-import warning shows up when running npm commands:

postcss-import: /Users/SangMinYoon/Websites/playground/wordpress/wp-content/themes/theme-scaffold/assets/css/frontend/style.css:15:1: /Users/SangMinYoon/Websites/playground/wordpress/wp-content/themes/theme-scaffold/assets/css/frontend/base/index.css isempty
postcss-import: /Users/SangMinYoon/Websites/playground/wordpress/wp-content/themes/theme-scaffold/assets/css/frontend/style.css:18:1: /Users/SangMinYoon/Websites/playground/wordpress/wp-content/themes/theme-scaffold/assets/css/frontend/layout/index.css is empty
postcss-import: /Users/SangMinYoon/Websites/playground/wordpress/wp-content/themes/theme-scaffold/assets/css/frontend/style.css:21:1: /Users/SangMinYoon/Websites/playground/wordpress/wp-content/themes/theme-scaffold/assets/css/frontend/templates/index.css is empty
postcss-import: /Users/SangMinYoon/Websites/playground/wordpress/wp-content/themes/theme-scaffold/assets/css/frontend/style.css:24:1: /Users/SangMinYoon/Websites/playground/wordpress/wp-content/themes/theme-scaffold/assets/css/frontend/components/index.css is empty

I recommend commenting out imports and not removing them just like frontend.js (// import foo from './components/bar';). I especially recommend this for plugin-scaffold. Current project I'm on, we have the imports commented out since CSS for the plugin has not been added to the project.

Let me know if you want me to create a PR for this.

composer.lock should not be in .gitignore

composer.lock file should be committed to our projects so that when we deploy them, we can run composer install and get a very specific set of package versions installed.

I could see maybe not wanting a composer.lock file in the scaffold repo, but we definitely want it in the repos that are generated as part of the scaffolding.

@apply in CSSnext only works once

There is an issue in where the @apply feature only works once. See these tickets:

In addition, the @apply rule sounds like it is no longer going to be included in future CSS spec at this time. From the plugin github:

The @apply rule and custom property sets most likely won't get any more support from browser vendors as the spec is yet considered deprecated and alternative solutions are being discussed.
Refer to following links for more infos:

https://discourse.wicg.io/t/needed-new-champion-for-css-apply-rule/2012
WICG/webcomponents#300 (comment)
http://www.xanthir.com/b4o00
w3c/csswg-drafts#1047

In both cases, the solution has been to use the "postcss-mixins" plugin instead: https://github.com/postcss/postcss-mixins

I think it may be a good idea to integrate this so we can retain the use of mixins. Additionally, in practice @apply acts more like an @extends versus a mixin, with no arguments. This should hold us over until a new standard is proposed and adopted.

Add conditional body class for `js` or `no-js` progressive enhancement

In the <head>

<head>
    document.body.classList.remove('no-js'); // if it's there
    document.body.classList.add('js');
</head>

In the component:

document.getElementById('the-component').setAttribute('aria-hidden', 'true');

In the CSS (assuming you need this):

.js the-component[aria-hidden="true] {
    display: none;
}

This could potentially help progressively enhance and prevent content flashing for elements getting aria-hidden from JavaScript.

One potential method to implement this is adding add_filter( 'body_class', $n( 'body_classes' ) ); here: https://github.com/10up/theme-scaffold/blob/master/includes/core.php#L24

And then something like this at the bottom of includes/core.php

/**
 * Adds custom classes to the array of body classes.
 *
 * @link https://developer.wordpress.org/reference/functions/body_class/
 * @param array $classes Classes for the body element.
 * @return array
 */
function body_classes( $classes ) {
    // Adds "no-js" class. If JS is enabled, this will be replaced (by javascript) to "js".
    $classes[] = 'no-js';

    return $classes;
}

Then add this document.body.className = document.body.className.replace( 'no-js', 'js' ); in: https://github.com/10up/theme-scaffold/blob/master/assets/js/frontend/frontend.js

Or, method two:

Just update <body <?php body_class( 'no-js' ); ?>> in Theme Scaffold's header.php

This would still require adding the JavaScript to frontend.js

There are probably other ways to implement this.

CSS nano not respecting settings in gulp task

Right now if you set any additional optimization options as part of the task runner in cssnano.js, those options are ignored. Our extra options currently line up with the tasks' default options.

Example
Create a style in the assets CSS like:

:root {
	--color-red: #f00;
}
.foo {
	appearance: none;
	border-color: var(--color-red);
	border-radius: 0;
	border-style: solid;
	border-width: 1px;
	display: block;
	height: 100px;
	padding-bottom: 1em;
	padding-left: 2em;
	padding-right: 2em;
	padding-top: 1em;
	transition: color 500ms ease-in-out;
	width: 100px;
}

Add mergeLonghand: false to the CSS nano task options and run npm run build. CSS nano should not be combining the border or padding rules. You will get output like:

:root {
	--c-black: #000;
	--c-white: #fff;
	--color-red: red
}

.foo {
	-webkit-appearance: none;
	-moz-appearance: none;
	appearance: none;
	border-color: red;
	border: 1px solid var(--color-red);
	border-radius: 0;
	display: block;
	height: 100px;
	padding: 1em 2em;
	transition: color .5s ease-in-out;
	width: 100px
}

As shown, the option is not respected. This actually causes a bug in IE11 where it will attempt to read all of the border property and fail to apply any of it. (Additional color vars are our defaults from variables.css).

Adding docs for Style Guide Template

Style Guide Template is a great feature. There could be short note on readme what does it mean:

  • Create a new page and set the template “style guide”.
  • Perhaps noting that this template can be extended for project needs. Adding Typography details and so on.

npm warnings

When I npm install on a freshly generated theme:

npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of
Node.js

...

npm WARN deprecated [email protected]: Package no longer supported. Contact [email protected] for more info.
npm WARN deprecated [email protected]: 🙌  Thanks for using Babel: we recommend using babel-preset-env now: please r
ead babeljs.io/env to update!

Add linting command for CSS

We have linting command for JS and PHP: npm run lint-js and npm run lint-php. I don't see a reason why we shouldn't have check for npm run lint-css.

CSS lint should also be added to lint-staged. I can do PR if this is supported idea.

Tidy up Stylelint errors

Currently, a Stylelint error is presented like so:

[20:41:24] 

assets/css/frontend/style.css
 29:14  ✖  Unexpected named color "red"   color-named



[20:41:24] 'lint-css' errored after 342 ms
[20:41:24] Error in plugin "gulp-stylelint"
Message:
    Failed with 1 error
Details:
    domainEmitter: [object Object]
    domain: [object Object]
    domainThrown: false

I think we should suppress most of this information, at least while watching the files. The only actual useful information is:

assets/css/frontend/style.css
 29:14  ✖  Unexpected named color "red"   color-named

The rest is pure noise.

Gutenberg block development support

With WordPress 5.0 set for release, we should begin preparation for updating the scaffold to include support for Gutenberg block development within themes.

I'm proposing that we introduce a folder at the root of the theme, which would contain a list of block folders. Each block folder would contain all code pertaining to that block including PHP, JS and CSS.

|- components/
|    |- blocks.php________________________ # Include all PHP block files
|- components/block-name/
|    |- block.php_________________________ # If this requires PHP for dynamic block or whitelisting 
|    |- block.css_________________________ # Block CSS 
|    |- block.js__________________________ # Block code

Optionally, other components can live in the components/ folder, which can contain all reusable custom components which are included in the block JS.

|- components/
|    |- component-name.css______________ # Component CSS 
|    |- component-name.js_______________ # React Component

The block JS code can be enqueued using:

/**
 * Enqueue Gutenberg's blocks.js
 */
function enqueue_block_assets() {
	wp_register_script(
		'block-editor-js',
		PROJECT_TEMPLATE_URL . '/dist/js/blocks.min.js',
		[ 'wp-i18n', 'wp-element', 'wp-blocks', 'wp-components' ],
		filemtime( PROJECT_PATH . 'dist/js/blocks.min.js' )
	);
}
add_action( 'enqueue_block_editor_assets',      $n( 'enqueue_block_assets' ) );

IDE Testing / Setup

Two questions:

This may not be the right place to document IDE settings / best practices, but I think these questions are worth pondering. Also, perhaps IDE settings / best practices should be owned by the engineer and not relevant. That being said....

  1. Do we need / want to add setup instructions or recommendations for IDE settings for engineers ramping up with the new scaffolding to potentially avoid a time suck? We could just to Sublime, VS Code, and PHP Storm.

  2. Are we testing different IDEs with scaffolding updates to make sure all works as expected? I have not kicked the tires on the scaffolding in a while, but I've heard there has been time suck on setup (particularly relating to file structure and code formatting challenges - which may have been resolved elsewhere) and I'd like to avoid that if possible.

CC: @timwright12

Feature: Implement StyleLint

This feature intends to implement PostCSS linting using stylelint and gulp-stylelint in order to better control the standardization of CSS development within 10up.

Stylelint: Website
Gulp Stylelint: Website

Show / hide sections in the styleguide

Hey all,

We've been using the styleguide quite a bit in a current project and it's been great.

One issue I keep running into though is finding the component I'm currently working on on a long page of other components. Often when you resize your screen, for example, the component you're working on gets pushed down the page and you need to go hunt for it.

I've written a quick show / hide script and have been using it locally. I can collapse sections I don't want to see and it persists those settings with localStorage. You just click the section heading to collapse / expand it.

Questions:

  1. Is this something we want in the theme at all, or is it best left to add per-project?
  2. If we want to add it, how should we do so? There's no scripts currently in use in the styleguide, so lets decide how this should get added ( if we add it).

In the screenshot, I've collapsed all the sections before the Hero so I can easily see and work on that.

styleguide hiding

Consider updating to Babel 7

We currently have "babel-core": "^6.26.0" and "babel-preset-env": "^1.6.1". In the long run I feel that we should move using more recent version of Babel. Here are couple of docs:

For the theme itself I don't see much issues when upgrading. For existing projects it might take more work.

If this is supported idea I can do PR.

Skip to content link is missing

Skip to content link is missing from the header.php. Ideally it should actually be inside landmark region because all content should be inside a landmark.

But that's not a hard rule, as long as it's the first focusable element inside <body>.

More info about skip links.

In short:

Skip link(s) main target group are keyboard users who probably don't use any AT devices. So they don't have shortcuts to <main> or other landmark regions.

From the screen reader survey:

It is important to note that while usage has decreased among screen reader users, "skip" links still provide notable benefit for other keyboard users.

Clean up the <head>

The following filters and actions pollute the <head> that is generated from a default WordPress theme, most of the features are either a security risk, legacy, or redundant for most projects:

add_filter( 'emoji_svg_url', '__return_false' );

remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'wp_head', 'wp_generator' );
remove_action( 'wp_head', 'wlwmanifest_link' );
remove_action( 'wp_head', 'rsd_link' );
remove_action( 'wp_head', 'wp_shortlink_wp_head' );
remove_action( 'wp_head', 'feed_links', 2 );
remove_action( 'wp_head', 'feed_links_extra', 3 );
remove_action( 'wp_head', 'rest_output_link_wp_head', 10 );
remove_action( 'wp_head', 'wp_oembed_add_discovery_links', 10 );
remove_action( 'template_redirect', 'rest_output_link_header', 11 );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );

remove_filter( 'wp_mail', 'wp_staticize_emoji_for_email' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );

Add a blocks.css file

Per @smy315's point here: #78 (comment)

We should probably include a blocks.css file to compliment the wordpress.css file we have now.

This looks like Automattic's. I haven't had a chance to even look that over yet, so no endorsement on that particular one. https://github.com/WordPress/gutenberg-starter-theme/blob/master/css/blocks.css

The biggest pain point on my last project with lots of Gutenberg blocks was input fields and labels. Some inputs are actual inputs, while others were div-based faux-inputs for richtext with no labels.

Should we include any Gutenberg Theme settings by default?

There are many potential Gutenberg-specific feature opt-ins that we can use: https://wordpress.org/gutenberg/handbook/extensibility/theme-support/

These should probably be revised on a project-by-project basis. That said, some of them seem like useful defaults:

Disabling custom font sizes
add_theme_support('disable-custom-font-sizes');

Disabling custom colors
add_theme_support( 'disable-custom-colors' );

Use editor styles in the WYSIWYG
add_theme_support('editor-styles');

Use responsive embeds
add_theme_support( 'responsive-embeds' );

suggestion: automatic versioning of assets

  • have gulp or grunt write a file w/ a timestamp
  • have functions.php consume the contents of that file and store a global variable
  • have all calls to wp_enqueue_script and wp_enqueue_style use that global for version number

this would ensure a fresh version every time assets are re-generated, regardless of whether that's locally (eases testing) or on deploy.

Why does TENUP_SCAFFOLD_URL exist?

Although it is defined in functions.php, I am not seeing any instance of TENUP_SCAFFOLD_URL used within the theme. Is there a reason this needs to exist by default?

Explore HTTP/2 push/prefetch

This issue is to remind myself to look into using HTTP/2 server push and/or prefetch to load CSS & JS assets now that HTTP/2 is specified in our systems best practices.

cc @timwright12 for visibility.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.