Created
December 27, 2021 21:19
-
-
Save krasenslavov/ae3fb684a1a1cb14402cba3f49624a48 to your computer and use it in GitHub Desktop.
How to Setup JS and CSS Environment Files (no external libraries)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
ob_start(); | |
include 'utils.mjs'; | |
include 'module1.mjs'; | |
include 'module2.mjs'; | |
include 'module3.mjs'; | |
$data = ob_get_clean(); | |
$expressions = array( | |
'MULTILINE_COMMENT' => '\Q/*\E[\s\S]+?\Q*/\E', | |
'SINGLELINE_COMMENT' => '(?:http|ftp)s?://(*SKIP)(*FAIL)|//.+', | |
'WHITESPACE' => '^\s+|\R\s*' | |
); | |
foreach ($expressions as $key => $expr) { | |
$data = preg_replace('~' . $expr . '~m', '', $data); | |
} | |
echo $data; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment