diff --git a/.gitignore b/.gitignore index 5b672c5..319b576 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ composer.lock /vendor/ /nbproject/ /src/dist/ +/node_modules/ +package-lock.json diff --git a/README b/README index 50ccae3..9fb5af8 100644 --- a/README +++ b/README @@ -25,12 +25,21 @@ cd /var/www/frames/tts_framework/vendor/ezyang/htmlpurifier/library sudo chgrp www-data HTMLPurifier/DefinitionCache/Serializer ``` -### Compile the framework!!! +### Manually Compile the framework!!! ``` cd /var/www/frames/tts_framework/src php compiler.php ``` +### Auto-Watch Compile the framework on PHP changes!!! +``` +cd /var/www/frames/tts_framework +# Install nodejs, npm, then if gulp-cli not installed yet: +sudo npm install --global gulp-cli +npm install +gulp +``` + ### Install JavaScript Lib: ``` cd /var/www/frames/ diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 0000000..d952fc7 --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,30 @@ +/** + * @author Robert Strutts + * @copyright Copyright (c) 2022, Robert Strutts. + * @license https://mit-license.org/ + */ + +const { src, dest, series, parallel, watch } = require('gulp'); +const exec = require('child_process').exec; + +const php_source_files = [ + '**/*.php', + '!**/dist/*.php' +]; + +function compile_php_files() { + return new Promise(function(resolve, reject) { + exec('php -f compiler.php', function (err, stdout, stderr) { + console.log(stdout); + console.log(stderr); + resolve(stdout); + }); + }); +} + +function watch_php() { + process.chdir('src'); + watch(php_source_files, compile_php_files); +} + +exports.default = series(watch_php); \ No newline at end of file diff --git a/package.json b/package.json new file mode 100644 index 0000000..2d617fe --- /dev/null +++ b/package.json @@ -0,0 +1,18 @@ +{ + "name": "tts_watch_php_compiler", + "version": "1.0.0", + "description": "TTS Framework PHP Compiler.", + "main": "gulpfile.js", + "scripts": { + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "Robert Strutts", + "license": "MIT", + "devDependencies": { + "gulp": "^4.0.2" + }, + "overrides": { + "chokidar": "3.5.3", + "glob-parent": "6.0.2" + } +} \ No newline at end of file