thipages / jsbuild
Automate js build
v0.1.1
2021-03-05 10:27 UTC
Requires
- ext-json: *
README
Automate js build
installation
composer require thipages/jsbuild
Usage
- Create a jsbuild.json file by hand or with this helper
use thipages\jsbuild\JSBuild; require('./vendor/autotload.php'); JSBuild::writeBuildModel();
or execute php -r "require './vendor/autoload.php';thipages\jsbuild\JSBuild::writeBuildModel();"
- Create rollup config files folder and package.json from a jsbuild.json file
use thipages\jsbuild\JSBuild; require('./vendor/autotload.php'); $builder=new JSBuild(); $builder->writeBuild();
-
update package.json dependencies if any
-
Create library entry point as ./esm/index.js
-
execute npm install
-
execute npm run build
This will create three root files
- index.js (esm)
- index.min.js (esm minified)
- min.js (iife minified)
Note : php script (point 2) can not be reused (no update process yet)