|
| 1 | +/* |
| 2 | + * Copyright 2016 The Closure Compiler Authors. |
| 3 | + * |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | + * you may not use this file except in compliance with the License. |
| 6 | + * You may obtain a copy of the License at |
| 7 | + * |
| 8 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | + * |
| 10 | + * Unless required by applicable law or agreed to in writing, software |
| 11 | + * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | + * See the License for the specific language governing permissions and |
| 14 | + * limitations under the License. |
| 15 | + */ |
| 16 | + |
| 17 | +/** |
| 18 | + * @fileoverview Gulpfile to compile with Closure Compiler in JS. |
| 19 | + */ |
| 20 | + |
| 21 | +const compiler = require('google-closure-compiler-js').gulp(); |
| 22 | +const gulp = require('gulp'); |
| 23 | +const sourcemaps = require('gulp-sourcemaps'); |
| 24 | + |
| 25 | +gulp.task('default', function() { |
| 26 | + return gulp.src(['helper.js', 'index.js']) |
| 27 | + .pipe(sourcemaps.init()) |
| 28 | + .pipe(compiler({ |
| 29 | + jsOutputFile: 'output.min.js', // filename returned to gulp |
| 30 | + compilationLevel: 'ADVANCED', // as opposed to 'SIMPLE', the default |
| 31 | + warningLevel: 'VERBOSE', // complain loudly on errors |
| 32 | + createSourceMap: true, // create output source map |
| 33 | + processCommonJsModules: true, // needed to support require() |
| 34 | + })) |
| 35 | + .pipe(sourcemaps.write('/')) |
| 36 | + .pipe(gulp.dest('./dist')); |
| 37 | +}); |
0 commit comments