How to use the google-closure-compiler.gulp function in google-closure-compiler

To help you get started, we’ve selected a few google-closure-compiler 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 ampproject / amphtml / build-system / compile / closure-compile.js View on Github external
nailgunPort,
        'org.ampproject.AmpCommandLineRunner',
        '--',
      ].concat(compilerOptions);
      pluginOptions.platform = ['native']; // nailgun-runner isn't a java binary
      initOptions.extraArguments = null; // Already part of nailgun-server
    } else {
      // For other platforms, or if nailgun is explicitly disabled, use AMP's
      // custom runner.jar
      closureCompiler.compiler.JAR_PATH = require.resolve(
        `../runner/dist/${nailgunPort}/runner.jar`
      );
    }
  }

  return closureCompiler.gulp(initOptions)(compilerOptions, pluginOptions);
}
github elix / elix / elements / demos / bower_components / shadydom / gulpfile.js View on Github external
* subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
 */

'use strict';

/* eslint-env node */
/* eslint-disable no-console */

let gulp = require('gulp');
let compilerPackage = require('google-closure-compiler');
let sourcemaps = require('gulp-sourcemaps');
let rollup = require('rollup-stream');
let rename = require('gulp-rename');
let source = require('vinyl-source-stream');
let buffer = require('vinyl-buffer');
let closureCompiler = compilerPackage.gulp();
let uglify = require('gulp-uglify');
let buble = require('rollup-plugin-buble')
let header = require('gulp-header');

let licenseHeader =
`/*
@license
Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
Code distributed by Google as part of the polymer project is also
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
*/
`;
github Kashomon / glift / deps / glift-core / dev / closure-compiler.js View on Github external
'use strict';


/**
 *
 */

const closureCompiler = require('google-closure-compiler').gulp({
  // extraArguments: ['-Xms2048m']
});

/**
 * defaultCompile passes defaults to the closureCompiler
 *
 * @param {string} outName whatever defaultCompile produces.
 *
 * @return {object} whatever closureCompiler returns.
 */
var defaultCompile = function(outName) {
  if (outName == '') {
    throw new Error('Name is required but was not provided')
  }

  return closureCompiler({
github elix / elix / elements / demos / bower_components / custom-elements / gulpfile.js View on Github external
* @license
 * Copyright (c) 2016 The Polymer Project Authors. All rights reserved.
 * This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
 * The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
 * The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
 * Code distributed by Google as part of the polymer project is also
 * subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
 */

'use strict';

const compilerPackage = require('google-closure-compiler');
const gulp = require('gulp');
const sourcemaps = require('gulp-sourcemaps');

const closureCompiler = compilerPackage.gulp();

gulp.task('default', () => {
  return gulp.src('./src/custom-elements.js', {base: './'})
      .pipe(sourcemaps.init())
      .pipe(closureCompiler({
          compilation_level: 'ADVANCED',
          warning_level: 'VERBOSE',
          language_in: 'ECMASCRIPT6_STRICT',
          language_out: 'ECMASCRIPT5_STRICT',
          externs: ['externs/html5.js', 'externs/custom-elements.js'],
          js_output_file: 'custom-elements.min.js',
          new_type_inf: true,
          rewrite_polyfills: false,
        }))
      .pipe(sourcemaps.write('/'))
      .pipe(gulp.dest('./'));
github ChadKillingsworth / geolocation-marker / gulpfile.js View on Github external
var gulp = require('gulp');
var sourcemaps = require('gulp-sourcemaps');
var compiler = require('google-closure-compiler');
var closureCompilerGulp = compiler.gulp();

var fs = require('fs');
var connect = require('gulp-connect');
var replace = require('gulp-replace');
var packageInfo = require('./package.json');

gulp.task('clean', function() {
  try {
    fs.unlinkSync('./geolocationmarker.js');
    fs.unlinkSync('./geolocationmarker.js.map');
  } catch (e) { }
});

gulp.task('compile', ['clean'], function() {
  return gulp.src('./src/**/*.js', {base: './'})
      .pipe(sourcemaps.init())
github omgimanerd / nycurl / gulpfile.js View on Github external
gulp.task('js-compile', function() {
  if (BUILD.JS_BUILD_RULES) {
    var compilerPackage = require('google-closure-compiler');
    var plumber = require('gulp-plumber');
    var closureCompiler = compilerPackage.gulp();
    var getClosureCompilerConfiguration = function(externs, compilationLevel,
                                                   filename) {
      return closureCompiler({
        externs: externs,
        warning_level: 'VERBOSE',
        compilation_level: compilationLevel,
        js_output_file: filename
      });
    };
    return merge(BUILD.JS_BUILD_RULES.map(function(rule) {
      return gulp.src(rule.sourceFiles)
        .pipe(plumber())
        .pipe(getClosureCompilerConfiguration(rule.externs,
                                              rule.compilationLevel,
                                              path.basename(rule.outputFile)))
        .pipe(gulp.dest(path.dirname(rule.outputFile)))
github pandanoir / unitaryjs / gulpfile.js View on Github external
const gulp = require('gulp');
const compilerPackage = require('google-closure-compiler');
const closureCompiler = compilerPackage.gulp();

compilerPackage.compiler.JAR_PATH = undefined;
compilerPackage.compiler.prototype.javaPath = './node_modules/.bin/closure-gun';

const rename = require("gulp-rename");
const gzip = require('gulp-gzip');

gulp.task('minify', done => {
    closureCompiler({
        js: './dist/canvas.js',
        compilation_level: 'SIMPLE',
        language_in: 'ECMASCRIPT6_STRICT',
        language_out: 'ECMASCRIPT5_STRICT',
        js_output_file: 'canvas.min.js'
    }).src()
    .pipe(gulp.dest('./dist/'));
github kubernetes / dashboard / build / script.js View on Github external
*/
import async from 'async';
import closureCompiler from 'google-closure-compiler';
import gulp from 'gulp';
import gulpHtmlmin from 'gulp-htmlmin';
import gulpIf from 'gulp-if';
import gulpModify from 'gulp-modify';
import gulpRename from 'gulp-rename';
import gulpReplaceTask from 'gulp-replace-task';
import path from 'path';
import webpackStream from 'webpack-stream';

import conf from './conf';
import {processI18nMessages} from './i18n';

const gulpClosureCompiler = closureCompiler.gulp();

/**
 * Tasks used to set node process env variables. They are used by our compile tasks. Based on them
 * different preset configs defined in '.babelrc' are used.
 */
gulp.task('set-prod-node-env', () => {
  return process.env.NODE_ENV = conf.build.production;
});

gulp.task('set-test-node-env', () => {
  return process.env.NODE_ENV = conf.build.test;
});

/**
 * Returns function creating a stream that compiles frontend JavaScript files into development
 * bundle located in {conf.paths.serve} directory. This has to be done because currently browsers do
github darrenbritton / darrenbritton.github.io / old-site / gulpfile.js View on Github external
var gulp = require('gulp');
var glob = require("glob");
var cache = require('gulp-cache');
var concat = require('gulp-concat');
var uncss = require('gulp-uncss');
var nano = require('gulp-cssnano');
var imagemin = require('gulp-imagemin');
var browserSync = require('browser-sync').create();
var compilerPackage = require('google-closure-compiler');
var closureCompiler = compilerPackage.gulp();

gulp.task('compileJs', function () {

    glob("./index.html", function (err, files) {
        if (err) throw err;

        files.forEach(function (file) {
            var jsPaths = ['./js/shared/*.js'];
            var filename = file.substring(file.lastIndexOf('/') + 1, file.lastIndexOf('.'));
            var outputName = filename + '.min.js';
            jsPaths.push('./js/' + filename + '/*.js');

            return gulp.src(jsPaths, { base: './' })
                .pipe(closureCompiler({
                    compilation_level: 'SIMPLE',
                    warning_level: 'QUIET',