Skip to content

Commit

Permalink
Events: Setup PostCSS
Browse files Browse the repository at this point in the history
  • Loading branch information
iandunn committed Nov 22, 2023
1 parent 03c5bd1 commit 10eb2bd
Show file tree
Hide file tree
Showing 10 changed files with 10,318 additions and 8,676 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -111,3 +111,4 @@ public_html/wp-content/themes/twentytwentytwo
public_html/wp-content/themes/twentytwentythree
public_html/wp-content/themes/twentytwentyfour
public_html/wp-content/themes/wporg-parent-2021
public_html/wp-content/themes/wporg-events-2023/style.css
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"public_html/wp-content/plugins/wc-post-types",
"public_html/wp-content/plugins/wcpt",
"public_html/wp-content/plugins/wordcamp-forms-to-drafts",
"public_html/wp-content/plugins/wordcamp-speaker-feedback"
"public_html/wp-content/plugins/wordcamp-speaker-feedback",
"public_html/wp-content/themes/wporg-events-2023"
],
"browserslist": [
"extends @wordpress/browserslist-config"
Expand Down
18 changes: 18 additions & 0 deletions public_html/wp-content/themes/wporg-events-2023/.stylelintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"extends": "@wordpress/stylelint-config",
"rules": {
"max-line-length": null,
"no-duplicate-selectors": null,
"no-descending-specificity": null,
"rule-empty-line-before": [
"always-multi-line",
{
"except": [
"first-nested",
"after-single-line-comment"
]
}
],
"selector-class-pattern": null
}
}
3 changes: 3 additions & 0 deletions public_html/wp-content/themes/wporg-events-2023/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# wporg-events-2023

You must run the `build` task for this to be recognized as a valid theme by WP.
19 changes: 19 additions & 0 deletions public_html/wp-content/themes/wporg-events-2023/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "wporg-events-2023",
"version": "0.0.1",
"description": "Description: Includes templates for the homepage, event archives, etc",
"license": "GPL-2.0-or-later",
"devDependencies": {
"cssnano": "^6.0.1",
"postcss": "^8.4.31",
"postcss-cli": "^10.1.0",
"postcss-import": "^15.1.0",
"postcss-preset-env": "^9.3.0"
},
"scripts": {
"watch": "npm run build -- --watch",
"build": "postcss postcss/style.pcss --output style.css",
"lint:js": "echo 'There is no JS, but this is required to make the `linter.yml` workflow pass. See https://github.com/yarnpkg/yarn/issues/6739, https://github.com/yarnpkg/yarn/issues/6894.'",
"lint:css": "wp-scripts lint-style 'postcss/*.pcss'"
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!-- wp:group {"className":"entry-content","layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"left"}} -->
<div class="wp-block-group entry-content">
<!-- wp:group {"className":"wporg-events__meet-community-map-wrapper","layout":{"type":"flex","flexWrap":"nowrap","justifyContent":"left"}} -->
<div class="wp-block-group wporg-events__cover">
<!-- wp:group {"style":{"elements":{"link":{"color":{"text":"var:preset|color|white"}}},"layout":{"selfStretch":"fixed","flexSize":"50%"},"spacing":{"padding":{"top":"var:preset|spacing|edge-space","bottom":"var:preset|spacing|edge-space","left":"var:preset|spacing|edge-space","right":"var:preset|spacing|edge-space"}}},"backgroundColor":"charcoal-2","textColor":"white","layout":{"type":"flex","orientation":"vertical","justifyContent":"left","flexWrap":"wrap"}} -->
<div class="wp-block-group has-white-color has-charcoal-2-background-color has-text-color has-background has-link-color"
style="padding-top:var(--wp--preset--spacing--edge-space);padding-right:var(--wp--preset--spacing--edge-space);padding-bottom:var(--wp--preset--spacing--edge-space);padding-left:var(--wp--preset--spacing--edge-space)">
Expand Down
23 changes: 23 additions & 0 deletions public_html/wp-content/themes/wporg-events-2023/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
const isProduction = process.env.NODE_ENV === 'production';

const plugins = [
// This has to run before any other plugins, to concatenate all files into one.
require( 'postcss-import' ),

// Enable transforms for stage 2+, explictly enable nesting (stage 1).
require( 'postcss-preset-env' )( {
stage: 2,
features: {
'nesting-rules': true,
},
} ),
];

// Minify.
if ( isProduction ) {
plugins.push( require( 'cssnano' ) );
}

module.exports = {
plugins,
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.wporg-events__cover {
gap: 0;
/* also add gap for other block */
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
* Text Domain: wporg
* Template: wporg-parent-2021
*/

@import "front-page/cover.pcss";
Loading

0 comments on commit 10eb2bd

Please sign in to comment.