Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
" * @version " + version + "\n" +
" * @license MIT\n" +
" */\n";
var jqueryOpen = "(function($){\n" +
"\n";
var jqueryClose = "\n" +
"})(jQuery);\n";
return gulp.src(buildGlob, { base: dest })
.pipe(plumber({ errorHandler: plumberErrorHandler }))
.pipe(sourcemaps.init())
.pipe(concat('garnish.js'))
.pipe(insert.prepend(jqueryOpen))
.pipe(insert.append(jqueryClose))
.pipe(insert.prepend(docBlock))
.pipe(gulp.dest(dest))
.pipe(uglify())
.pipe(concat('garnish.min.js'))
.pipe(insert.prepend(docBlock))
.pipe(sourcemaps.write('.', {
mapFile: function(mapFilePath) {
// source map files are named *.map instead of *.js.map
return mapFilePath.replace('.js.map', '.map');
}
}))
.pipe(gulp.dest(dest));
}
});
gutil.log("building js files...");
const jsBuildStream = gulp.src(jsFiles)
.pipe(filterNonCodeFiles())
.pipe(utils.buildNgMaterialDefinition())
.pipe(plumber())
.pipe(ngAnnotate())
.pipe(utils.addJsWrapper(true));
const jsProcess = series(jsBuildStream, themeBuildStream())
.pipe(concat('angular-material.js'))
.pipe(BUILD_MODE.transform())
.pipe(insert.prepend(config.banner))
.pipe(insert.append(';window.ngMaterial={version:{full: "' + VERSION + '"}};'))
.pipe(gulp.dest(config.outputDir))
.pipe(gulpif(!IS_DEV, uglify({output: {comments: 'some'}})))
.pipe(rename({extname: '.min.js'}))
.pipe(gulp.dest(config.outputDir));
return series(jsProcess, deployMaterialMocks());
// Deploy the `angular-material-mocks.js` file to the `dist` directory
function deployMaterialMocks() {
return gulp.src(config.mockFiles)
.pipe(gulp.dest(config.outputDir));
}
}
function buildSkinFiles(colorStop, globs, prependString, appendString, dest) {
prependString = prependString || '';
appendString = appendString || '';
dest = dest || 'dist/components/';
return gulp.src(globs)
.pipe(plumb())
.pipe(insert.prepend(`@import '../../dist/vars/spectrum-dimensions.css';\n@import '../colorStops/spectrum-${colorStop}.css';${prependString}`))
.pipe(insert.append(appendString))
.pipe(postcss(processors))
.pipe(replace(/^&/gm, '.spectrum')) // Any stray & in colorstops should just apply to .spectrum
.pipe(rename(function(path) {
path.dirname += '/colorStops';
path.basename = colorStop;
}))
.pipe(gulp.dest(dest));
}
function buildMultistops(colorStop) {
return gulp.src('dist/spectrum-' + colorStop + '.css')
.pipe(plumb())
// Simply wrap the file in the colorstop
// This is a workaround for the fact that postcss-import and postcss-nested can't play together
.pipe(insert.prepend(`.spectrum--${colorStop} {\n`))
.pipe(insert.append('}\n'))
.pipe(postcss([require('postcss-nested')]))
.pipe(gulp.dest('dist/'));
}