UNPKG

1.06 kBJavaScriptView Raw
1const utils = require('../utils');
2const chalk = require('chalk');
3const data = utils.getManifest();
4const createLogger = require('logging').default;
5const logger = createLogger('Revision');
6const argv = require('minimist')(process.argv.slice(2));
7const nodeRev = require('node-rev').default;
8
9const customFiles = data.revAssets || [];
10
11const defaultFiles = [
12 `${data.paths.dist}**/*.css`,
13 `${data.paths.dist}**/*.js`,
14];
15
16const files = defaultFiles.concat(customFiles).join(',');
17
18const options = {
19 files: files, //glob to files you want in the manifest
20 outputDir: data.paths.dist,//where you want the files to be output that are part of the manifest
21 file: data.paths.dist + 'rev-manifest.json',//optional, allows you to specify location of manifest file and name it, default is root of the project
22 hash: argv.production //if you are in dev mode, you can set this to false to just have it create the manifest with the same filenames
23};
24
25logger.info('Starting Assets revision');
26
27nodeRev(options);
28
29logger.info(chalk.green('Succeed Assets revision'));