From 44edbd5b30fcc9f6287cfaf1be8c2948b5446189 Mon Sep 17 00:00:00 2001 From: downhiller Date: Tue, 7 Jan 2025 13:07:19 +0000 Subject: [PATCH] Added functionality to remove code after a /*DEV*/ comment --- src/JS.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/JS.php b/src/JS.php index 9cf43a2..0dfe48f 100644 --- a/src/JS.php +++ b/src/JS.php @@ -195,6 +195,12 @@ public function execute($path = null) */ protected function stripComments() { + // enable removal of /*DEV*/ style comments + // this pattern will replace from "/*DEV*/" to end of line - e.g. "/*DEV*/ console.log(data);" -> "" + // it needs to come before the call to stripMultilineComments, otherwise that deletes + // the crucial /*DEV*/, while leaving the rest of the line entact + $this->registerPattern('/\/\*DEV\*\/.*$/m', ''); + $this->stripMultilineComments(); // single-line comments