Node.js CLI to create pathmap index module from directory structure.
From
|-src
|-assets
|- font
|- aldrich.woff
|- image
|- player.png
|- enemy.png
👇 To
// src/assets/index.js
import mod_0 from "./font/aldrich.woff";
import mod_1 from "./image/player.png";
import mod_2 from "./image/enemy.png";
export default {
font: {
aldrich: mod_0,
},
image: {
player: mod_1,
enemy: mod_2,
},
};
Node.js v10.10.0+
npm install dimic -g
dimic [--options]
dimic -i public/static
Default input directory is src/assets/
, but you can change this by --input-dir
(-i
in short) option.
dimic -o index.ts
Default output file name is index.js
, but you can change this by --output-file
(-o
in short) option.
dimic --watch
Add this option if you want to output file in accordance with directory change.
(-w
in short)
dimic --match *
You can filter files/directories to be mapped by adding --match
option.
Use glob pattern to set value.
Default is !_*
, which means files/dirs starting from "_" are ignored.
npm run test