How to use uglify-es - 10 common examples

To help you get started, we’ve selected a few uglify-es examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aerojs / aero / lib / App / minifyScripts.js View on Github external
let minify = function(source, file) {
	// Minify
	source = uglifyJS.minify({
		[file]: source
	}, uglifyJSOptions).code

	return source
}
github cyyyu / parcel-plugin-sw-precache / index.js View on Github external
getServiceWorkder(options).then(codes => {

      // Adding additionalCode to ServiceWorker File
      if(options.additionalCodeFile) {
        const additionalCode = readFileSync(path.resolve(rootDir, options.additionalCodeFile), 'utf8');
        codes += additionalCode;
      }

      const fileName = 'service-worker.js'
      if (minify) {
        const compressedCodes = {}
        compressedCodes[fileName] = codes
        codes = UglifyJS.minify(compressedCodes).code
      }

      const serviceWorkerFilePath = path.resolve(outDir, fileName)
      writeFileSync(serviceWorkerFilePath, codes)
    })
  })
github LivelyKernel / lively.next / lively.morphic / tools / build-source-bundle.js View on Github external
.then(sources => {
    console.log("writing files...")
    fs.writeFileSync(targetFile1, sources.noDeps);
    fs.writeFileSync(targetFile2, sources.complete);
    fs.writeFileSync(targetFile1.replace('.js', '.min.js'), uglifyjs.minify(sources.noDeps, {keep_fnames: true}).code); 
    fs.writeFileSync(targetFile2.replace('.js', '.min.js'), uglifyjs.minify(sources.complete, {keep_fnames: true}).code); 
})
github sidvishnoi / fb-dev-interest / webpack.config.js View on Github external
function minifyFilesBeforeCopy(content, $path) {
  const result = UglifyJS.minify(content.toString());
  if (result.error) {
    console.error($path);
    throw result.error;
  }
  return result.code;
}
github GridSpace / grid-apps / js / web-server.js View on Github external
function minify(path) {
    let code = fs.readFileSync(path);
    let mini = uglify.minify(code.toString());
    if (mini.error) {
        console.trace(mini.error);
        throw mini.error;
    }
    return mini.code;
}
github jhdrn / myra / rollup.config.js View on Github external
process.env.BUILD === 'production' && uglify({}, function (code) {
            return minify(code, {
                output: {
                    comments: 'some'
                }
            })
        }),
github salesforce / lwc / packages / wire-service / rollup.config.umd.prod.js View on Github external
        prod && uglify({}, code => minify(code))
    ].filter((plugin) => plugin);
github ForbesLindesay / browserify-middleware / lib / build-response.js View on Github external
function minify(str, options) {
  if (!options || typeof options !== 'object') options = {};
  const result = uglify.minify(str, options);
  if (result.error) {
    throw result.error;
  }
  return result;
}

uglify-es

JavaScript parser, mangler/compressor and beautifier toolkit for ES6+

BSD-2-Clause
Latest version published 7 years ago

Package Health Score

50 / 100
Full package analysis

Popular uglify-es functions