/*
* node-htmlprocessor
* https://github.com/dciccale/node-htmlprocessor
*
* Copyright (c) 2013-2023 Denis Ciccale (@dciccale)
* Licensed under the MIT license.
* https://github.com/dciccale/node-htmlprocessor/blob/master/LICENSE-MIT
*/
'use strict';
var fs = require('fs');
module.exports = Parser;
function Parser(options) {
this.options = options || {};
this.listFile = null;
if (this.options && this.options.list) {
// Set our log file as a writestream variable with the 'a' flag
this.listFile = fs.createWriteStream(this.options.list, {
flags: 'a',
encoding: 'utf8',
mode: parseInt('744', 8)
});
}
// Set up regular expressions
/*
*
* - type (required) js, css, attr, remove, template, include
* - target|attribute (optional) i.e. dev, prod, release or attributes like [href] [src]
* - value (optional) i.e. script.min.js
*/
this.regStart = new RegExp(
')*'
);
//
this.regEnd = new RegExp(
'(?:'
);
//
this.cssHref = /^\s*