UNPKG

lilacs

Version:

A web frontend building tool for teamwork, with automaticly compiling, merging, minifying, syncing files to server, supporting distributed servers, ensuring css or html files' inline reference with correct absolute path, and more.

28 lines (20 loc) 674 B
'use strict'; var fs = require('fs'); var rd = require('rd'); var vars = require('../data/vars'); var cleanMatches = require('./clean_matches'); module.exports = (hashLength) => { var hashCodes = []; var htmlDirectory = vars.projectRoot + '/dist/html'; // find all file and extract hash codes. fs.existsSync(htmlDirectory) && rd.eachFileFilterSync(htmlDirectory, (file) => { // file content var content = fs.readFileSync(file); var regExp = cleanMatches.newContent(hashLength); var result; while(result = regExp.exec(content)) { hashCodes.push(result[1]); } }); return hashCodes; };