Skip to content

Instantly share code, notes, and snippets.

View jeromecoupe's full-sized avatar
💭
coding away

Jérôme Coupé jeromecoupe

💭
coding away
View GitHub Profile
{#
Use case a podcast website:
- programs (have asset and categories)
- episodes (relation source)
#}
{# get all programs Ids #}
{% set allProgramsIds = craft.entries()
.section("programs")
.limit(null)
{# Layout File: src/_includes/layouts/sidebar.njk (in 11ty, layouts have to be in src/_includes by default) #}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{ metaTitle }}</title>
</head>
<body>
{% block content %}{% endblock %}
@jeromecoupe
jeromecoupe / package.json
Created December 2, 2020 10:30
Minimal NPM script Sass
{
"name": "sass-npm-scripts",
"version": "1.0.0",
"author": "Jérôme Coupé",
"description": "Minimal Sass NPM scripts",
"main": "index.js",
"scripts": {
"build:styles": "sass --style=compressed src/scss/:dist/css/",
"watch:styles": "onchange src/scss/**/*.scss -- npm run build:styles",
"watch": "npm-run-all --parallel watch:**",
@jeromecoupe
jeromecoupe / deploy.yaml
Last active August 2, 2023 16:41
Github actions: build and deploy Craft sites (WIP)
name: Craft CMS deployments
on:
push:
branches: [master]
jobs:
build-and-deploy:
runs-on: ubuntu-latest
@jeromecoupe
jeromecoupe / getnews.twig
Last active November 2, 2020 18:10
Probably not a good idea: normalize array of objects in Craft
{# variables #}
{% set allNews = [] %}
{% set today = "now"|date("Y-m-d") %}
{# create custom allNews array of objects #}
{% set news = craft.entries()
.section(["news"])
.with([
"newsImage"
])
@jeromecoupe
jeromecoupe / cases.js
Last active November 18, 2019 17:12
Sort post by categories with 11ty data files
const cases = [
{
id: "123456",
title: "This is a case red blue",
categories: [
{ id: "1", slug: "red" },
{ id: "2", slug: "blue" }
]
},
{
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@jeromecoupe
jeromecoupe / bitbucket-pipelines.yml
Last active August 2, 2019 11:29
Minimal Bitbucket Pipelines
# Only use spaces to indent your .yml configuration.
# $SSH_USER $ROOT_PATH $SSH_IP:$SSH_PATH are environment variables
# image
image: node:latest
# pipelines
pipelines:
default:
- step:
@jeromecoupe
jeromecoupe / webstoemp-gulpfile.js
Last active October 12, 2024 17:22
Gulp 4 sample gulpfile.js. For a full explanation, have a look at https://www.webstoemp.com/blog/switching-to-gulp4/
"use strict";
// Load plugins
const autoprefixer = require("autoprefixer");
const browsersync = require("browser-sync").create();
const cp = require("child_process");
const cssnano = require("cssnano");
const del = require("del");
const eslint = require("gulp-eslint");
const gulp = require("gulp");
@jeromecoupe
jeromecoupe / gulpfile.js
Last active January 19, 2024 13:43
responsive image pipeline in Gulp
"use strict";
// ---------------------------------------
// packages
// ---------------------------------------
const del = require("del");
const deleteEmpty = require("delete-empty");
const globby = require("globby");
const gulp = require("gulp");