Skip to content

Instantly share code, notes, and snippets.

View brianroadifer's full-sized avatar

Brian Ray Roadifer brianroadifer

View GitHub Profile
@brianroadifer
brianroadifer / word-count.validator.ts
Last active July 3, 2020 20:22
Angular Word Count Validator
import { AbstractControl, ValidationErrors, ValidatorFn } from '@angular/forms';
export class WordCountValidators {
/**
* The Regex used to seperate words from white space characters.
*/
private static seperator = /\s+/gmu;
/**
* @description
@brianroadifer
brianroadifer / ngpurge.js
Last active June 29, 2023 04:19
Angular PurgeCSS Script
// orignal author @dylanvdmerwe - https://dev.to/dylanvdmerwe/reduce-angular-style-size-using-purgecss-to-remove-unused-styles-3b2k
const exec = require("child_process").exec;
const fs = require("fs");
const path = require("path");
const chalk = require("chalk");
function removeUnusedCSS() {
var pathPrefix = process.argv.slice(2)[0];
// find the styles css file
const files = getAllFiles(`./${pathPrefix}/`, ".css");