File: esbuild.js

Recommend this page to a friend!
  Classes of Dom Hastings   JS Image to ANSI   esbuild.js   Download  
File: esbuild.js
Role: Auxiliary script
Content type: text/plain
Description: Auxiliary script
Class: JS Image to ANSI
Convert an image pixels to ANSI colour codes
Author: By
Last change: Updates and simplification to core code.
Added `docker-compose.yml` for easy local testing.
Date: 2 years ago
Size: 1,083 bytes
 

Contents

Class file image Download
const { sassPlugin } = require('esbuild-sass-plugin'), { Prettier } = require('esbuild-plugin-prettier'), { build } = require('esbuild'), path = require('path'); process.stdout.write(`Building... `); build({ entryNames: '[dir]/[name]', entryPoints: ['src/js/app.ts', 'src/css/app.scss'], bundle: true, minify: true, sourcemap: true, watch: process.argv.includes('watch') ? { onRebuild(error, result) { if (error) { console.log('\x1b[31mError rebuilding:\x1b[0m'); console.error(error); return; } console.log('\x1b[32mRebuilt.\x1b[0m'); }, } : false, outdir: 'dist', plugins: [ sassPlugin({ includePaths: [ path.resolve(__dirname, "node_modules"), ] }), new Prettier(), ], }) .then(() => { console.log('\x1b[32mdone.\x1b[0m'); }) .catch((e) => { console.log(`\x1b[31mfailed.\x1b[0m`); console.log(''); console.error(e); process.exit(1); });