Skip to content

Instantly share code, notes, and snippets.

@jgodson
jgodson / checkout-script-messages.liquid
Last active November 30, 2020 21:39
Show script discount messages in checkout on your Shopify store
(function() {
// The events to listen for to append the messages
// page:change is all we really need, but the page:load will fire sooner
// so the messages will be less likely to pop-in
var events = ['page:load', 'page:change'];
events.forEach(function(event) {
document.addEventListener(event, appendScriptMessages);
});
@reinink
reinink / webpack.mix.js
Created November 20, 2017 13:19
Using Purgecss with Tailwind and Laravel Mix
let cssImport = require('postcss-import')
let cssNext = require('postcss-cssnext')
let glob = require('glob-all')
let mix = require('laravel-mix')
let purgeCss = require('purgecss-webpack-plugin')
let tailwind = require('tailwindcss')
mix.js('resources/assets/js/app.js', 'public/js')
.postCss('resources/assets/css/app.css', 'public/css/app.css', [
cssImport(),
@andrewdelprete
andrewdelprete / webpack.config.js
Last active April 12, 2023 01:55
Webpack: Tailwind CSS + PurgeCSS Example
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const path = require("path");
const glob = require("glob-all");
const PurgecssPlugin = require("purgecss-webpack-plugin");
/**
* Custom PurgeCSS Extractor
* https://github.com/FullHuman/purgecss
* https://github.com/FullHuman/purgecss-webpack-plugin
*/
@andrewdelprete
andrewdelprete / webpack.mix.js
Last active August 28, 2024 21:30
Laravel Mix: Tailwind CSS + PurgeCSS Example
let mix = require("laravel-mix");
let tailwindcss = require("tailwindcss");
let glob = require("glob-all");
let PurgecssPlugin = require("purgecss-webpack-plugin");
/**
* Custom PurgeCSS Extractor
* https://github.com/FullHuman/purgecss
* https://github.com/FullHuman/purgecss-webpack-plugin
*/
@dek4nice
dek4nice / multiple-blocks-in-jade-mixins.pug
Last active October 15, 2017 14:46
Multiple blocks in Jade/Pug mixins
//- Multiple blocks in jade mixins? #1693
//- https://github.com/pugjs/pug/issues/1693
//- [Issue on github]
//- https://github.com/pugjs/pug/issues/1693
h2 Issue
p
a(href='https://github.com/pugjs/pug/issues/1693' , target="_blank") Multiple blocks in jade mixins?
hr
@BroFox86
BroFox86 / macro.html
Last active December 19, 2022 16:14
[Responsive image] Pug/Nunjucks responsive image mixin/macro #responsive
{% macro respImg(
class,
srcset,
sizes,
src,
width = "",
height = "",
loading = "",
alt = ""
)%}
@zakhardage
zakhardage / product price table
Created March 26, 2017 03:40
product price table - hard coded value categories
{% for variant in product.variants %}
{% assign option = variant.option1 | downcase %}
{% assign p = variant.price | money %}
{% unless option contains '+' or option contains 'swatch' %}
{% if option contains '1-4' %}
{% assign one = p %}
{% else %}
{% unless option contains '-' %}{% assign one = p %}{% endunless %}
{% endif %}
{% endunless %}
@zakhardage
zakhardage / cart using wholesale discount
Created March 18, 2017 05:07
cart using wholesale discount
{% if customer %}{% assign tags = customer.tags | join:' ' | downcase %}{% if tags contains 'wholesale' %}{% assign wholesale = true %}{% endif %}{% endif %}
{% if wholesale %}
{% if tags contains 'reorder' or customer.orders_count > 0 %}{% assign reorder = true %}{% endif %}
{% assign min = settings.cart-min | times:100 | minus:1 %}
{% if reorder %}{% assign min = setting.cart-min-reorder | times:100 | minus:1 %}{% endif %}
{% endif %}
<div class="meta grid">
{% if wholesale %}{% assign total = cart.total_price | divided_by:2 %}{% else %}{% assign total = cart.total_price %}{% endif %}
<p>{{ total | money | remove:' ' }}</p>
@zakhardage
zakhardage / Pop up and cookies
Created December 16, 2016 18:06
Pop up and cookies
// Newsletter popup
$(document).ready(function() {
$('.response').addClass('rte');
var coOkie = getCookie("bellePopup");
if (coOkie != "") {console.log('coOkie set');} else {newsletterPopup();}
});
function newsletterPopup() {
setTimeout(function() {
$('.overlay').fadeIn();
$('.pop').fadeIn();
@vickychijwani
vickychijwani / kanban.css
Last active November 30, 2020 21:41
A simple Trello clone in Eve (CSS ripped from Trello itself)
.board {
width: 100%;
height: 100%;
/* background-color: #0079bf; */
display: flex;
flex-direction: column;
}
.board,
.board textarea {