- Sage doesn't come with Purgecss (or uncss, etc.)
- Say, we use Bulma -- suddenly
dist/main.css
grows by 400K! - Let's purge it!
- Oh dang, we need to whitelist
/\.wp-/
,/\.post-type/
,/myfancylightbox/
... - Wait we are whitelisting pretty much everything from
/resource/assets/styles
! - Isn't there an option to purge
/node_modules/**/*
only? - Nope.
purgecss start ignore
, strategically placed, to the rescue!
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Adjust FacetWP "Radio" HTML output to be friendlier with our theme | |
add_filter('facetwp_facet_html', function ($output, $params) { | |
// Check that this facet is a "radio" type facet before proceeding. | |
if ('radio' == $params['facet']['type']) { | |
// Initialize our variables | |
$output = ''; |
Snippets frequently used with Sage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
workflows: | |
version: 2 | |
main: | |
jobs: | |
- php56-build | |
- php70-build | |
- php71-build | |
- php72-build | |
- deploy: | |
requires: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
const PostListing = ({post}) => ( | |
<article> | |
<h3>{post.frontmatter.title}</h3> | |
<span>{post.frontmatter.date}</span> | |
<p>{post.excerpt}</p> | |
</article> | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
root() { | |
local root | |
if [[ "$PWD" == *"/trellis"* ]]; then | |
root=${PWD%/trellis*} | |
elif [[ "$PWD" == *"/site"* ]]; then | |
root=${PWD%/site*} | |
elif [[ -d "$PWD/trellis" || -d "$PWD/site" ]]; then | |
root=${PWD} | |
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Regolith aka Un-Bedrock | |
# "But what if we need to hand it off to another agency?" No more! | |
# This script converts a Bedrock site to a normal WordPress structure. | |
# Run it from the root of a Bedrock project. | |
# Created by Nathan Knowler and Daniel Roe | |
echo "Converting Bedrock to a normal WordPress file structure..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import FruitContext from './FruitContext'; | |
import FruityComponent from './FruityComponent'; | |
export class App extends Component { | |
state = { | |
fruit: 'apple', | |
} |
Tested only on Ubuntu 24.04, KDE Neon User Edition (based on Ubuntu 24.04) and OSX Mojave or higher.
will probably work on other newer versions, with no changes, or with few changes in non-python dependencies (apt-get
packages)
NOTE: Don't create a .sh file and run it all at once. It may will not work. Copy, paste, and execute each command below manually. :-)
# DO NOT RUN THIS AS A ROOT USER