Skip to content

thipages/jsbuild

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

jsbuild

Automate js build

installation

composer require thipages/jsbuild

Usage

  1. 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();"

  1. 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();
  1. update package.json dependencies if any

  2. Create library entry point as ./esm/index.js

  3. execute npm install

  4. 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)