bspot / phpsourcemaps

Generate and read source maps using PHP

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PHP Source Maps

(Note that all of this is quick and dirty.)

Generate source maps using PHP.

Usage

Include:

require "SourceMap.php";

Create a new map, giving the name of the file the map is for, as well as the source files:

$map = new SourceMap("outfile.js", array("infile1.js", infile2.js"));

Add mappings:

$map->mappings[] = array(
  'dest_line' => 0, // Line in the compiled file
  'dest_col' => 0, // Column in the compiled file
  'src_index' => 0, // Index of the source file
  'src_line' => 0, // Line in the source file
  'src_col' => 0, // Column in the source file
);

Get JSON representation of the source map:

$json = $map->generateJSON();

About

Generate and read source maps using PHP


Languages

Language:PHP 97.9%Language:JavaScript 2.1%