Apache is running on port 80 and interfering with Valet.
- Stop Apache:
sudo /usr/sbin/apachectl stop
- Restart Valet:
valet restart
$.ajax({ | |
url: "http://localhost:33460/api/Account/userinfo", | |
dataType: 'json', | |
data: { | |
foo: 'bar' | |
}, | |
success: function(data, status) { | |
return console.log("The returned data", data); | |
}, | |
beforeSend: function(xhr, settings) { xhr.setRequestHeader('Authorization','Bearer ' + tokenString ); } //set tokenString before send |
In 5 minutes, you’ll have a brand new clean Statamic site, with Tailwind CSS and PurgeCSS configured.
It assumes that you work on a Mac, you put your site in ~/sites and you use Laravel Valet.
All the credit go to Jack McDade and philipboomy, from whom I stole and adapt the build scripts and the PurgeCSS config, this is only a detailed write up of the process.
You'll need Yarn and Node. You can install them both in one command via Brew: brew install yarn
After trying several methods, I find this the best way to setup a multi-day events page in Statamic...especially if you need daily scheduled event times as well. Please see the finished product at https://www.fishcap.net/events/huk-bassmaster-elite-at-the-st-lawrence-river-presented-by-black-velvet.
fields:
start_date:
display: Start Date
type: date
allow_blank: false
<?php | |
// Netlify Webhook Build Function | |
// -- this function will trigger a rebuild on post update | |
// -- add your api key or url below | |
add_action( 'save_post', 'netlify_rebuild'); | |
function netlify_rebuild( $post_id ) { | |
if ( wp_is_post_revision( $post_id ) ) { | |
return; | |
} |
function slugify(text) | |
{ | |
return text.toString().toLowerCase() | |
.replace(/\s+/g, '-') // Replace spaces with - | |
.replace(/[^\w\-]+/g, '') // Remove all non-word chars | |
.replace(/\-\-+/g, '-') // Replace multiple - with single - | |
.replace(/^-+/, '') // Trim - from start of text | |
.replace(/-+$/, ''); // Trim - from end of text | |
} |
import React from 'react' | |
import styled from 'styled-components' | |
class ScrollingWrapper extends React.Component { | |
state = { hasScrolled: false } | |
componentDidMount() { | |
this.scrollingWrapper.addEventListener('scroll', this.onScroll) | |
} |
If a project has to have multiple git repos (e.g. Bitbucket and Github) then it's better that they remain in sync.
Usually this would involve pushing each branch to each repo in turn, but actually Git allows pushing to multiple repos in one go.
If in doubt about what git is doing when you run these commands, just
This issue is so infuriating that I'm going to take some time to write about it.
MOST IMPORTANT. Your local development server must be bound to IP address 0.0.0.0. Some do this by default, but many don't. You need to make sure that you run your local server with correct IP bindings. You may need to provide additional flags to your serve commands e.g. polymer serve --hostname domain.local
, hugo serve --bind 0.0.0.0
. If you use a named domain like domain.local
, it has to be defined in /etc/hosts
and pointing at 0.0.0.0.
My Parallels setting is using Shared Network, nothing special there.
Open macOS Terminal and type ifconfig
. Look for the value under vnic0
> inet
. It is typically 10.211.55.2
.
/** | |
* This script can be placed in the root of your studio folder, | |
* and be run with `sanity exec deleteDocsWithoutSchema.js --with-user-credentials | |
*/ | |
import client from 'part:@sanity/base/client' | |
const getSanitySchema = require('./node_modules/@sanity/core/lib/actions/graphql/getSanitySchema') | |
const Schema = getSanitySchema(process.cwd()) | |
const types = Schema._original.types.map(({name}) => name) |