#!/usr/bin/env node const AssetGraph = require('../lib/AssetGraph'); const urlTools = require('urltools'); const commandLineOptions = require('yargs') .usage('$0 image1 image2...') .demand(1).argv; new AssetGraph({ root: commandLineOptions.root }) .logEvents({ repl: commandLineOptions.repl, stopOnWarning: commandLineOptions.stoponwarning, suppressJavaScriptCommonJsRequireWarnings: true, }) .loadAssets(commandLineOptions._.map(urlTools.fsFilePathToFileUrl)) .queue(function () { console.warn('BEFORE:'); }) .writeStatsToStderr() .processImages({ isImage: true }, { autoLossless: true }) .writeAssetsToDisc({ protocol: 'file:', isImage: true, isDirty: true }) .queue(function () { console.warn('\nAFTER:'); }) .writeStatsToStderr() .run();