mirror of
https://github.com/S2-/minifyfromhtml.git
synced 2025-08-03 12:20:04 +02:00
add some babel stuff
This commit is contained in:
30
node_modules/babel-minify/lib/index.js
generated
vendored
Normal file
30
node_modules/babel-minify/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,30 @@
|
||||
"use strict";
|
||||
|
||||
const babelCore = require("@babel/core");
|
||||
|
||||
const babelPresetMinify = require("babel-preset-minify");
|
||||
|
||||
module.exports = function babelMinify(input, // Minify options passed to minifyPreset
|
||||
// defaults are handled in preset
|
||||
options = {}, // overrides and other options
|
||||
{
|
||||
minified = true,
|
||||
inputSourceMap,
|
||||
sourceMaps = false,
|
||||
sourceType = "script",
|
||||
// to override the default babelCore used
|
||||
babel = babelCore,
|
||||
// to override the default minify preset used
|
||||
minifyPreset = babelPresetMinify
|
||||
} = {}) {
|
||||
return babel.transformSync(input, {
|
||||
babelrc: false,
|
||||
configFile: false,
|
||||
presets: [[minifyPreset, options]],
|
||||
comments: false,
|
||||
inputSourceMap,
|
||||
sourceMaps,
|
||||
minified,
|
||||
sourceType
|
||||
});
|
||||
};
|
Reference in New Issue
Block a user