Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
gulp.task('gulp-insert-tests', () => {
return gulp.src('*.js')
.pipe(insert.prepend('/* Inserted using gulp-insert prepend method */\n'))
.pipe(insert.prepend('\n/* Inserted using gulp-insert append method */'))
.pipe(insert.wrap(
'/* Inserted using gulp-insert wrap method */\n',
'\n/* Inserted using gulp-insert wrap method */'
))
.pipe(insert.transform((contents, file) => {
var comment = '/* Local file: ' + file.path + ' */\n';
return comment + contents;
}))
.pipe(gulp.dest('gulp-insert'));
});
gulp.task('dist--each', function (done) {
distPaths = distPaths || toDist;
outPath = outPath || placeDist;
gulp.src(distPaths)
.pipe(sourcemap.init())
.pipe(insert.prepend('!function(){null===window.a11y&&(window.a11y={})}()\n'))
.pipe(rename({
extname: '.min.js'
}))
.pipe(uglify())
.pipe(sourcemap.write('./'))
.pipe(gulp.dest(outPath));
});
var task = function() {
return gulp.src(srcDir + 'plugin.js')
.pipe(rename(package.name + '.js'))
.pipe(insert.prepend(header))
.pipe(streamify(replace('{{ version }}', package.version)))
.pipe(gulp.dest(outDir))
.pipe(rename(package.name + '.min.js'))
.pipe(streamify(uglify({ preserveComments: 'license' })))
.pipe(gulp.dest(outDir));
};
gulp.task('min', function() {
return gulp.src([
'src/Tween.js'
])
.pipe(uglify())
.pipe(insert.prepend(header))
.pipe(rename('tween.min.js'))
.pipe(gulp.dest('build'));
});
gulp.task('min', function() {
return gulp.src([
'src/Tween.js'
])
.pipe(uglify())
.pipe(insert.prepend(header))
.pipe(rename('tween.min.js'))
.pipe(gulp.dest('build'));
});
gulp.task('copy', function () {
return gulp.src('src/gifshot.js')
.pipe(insert.prepend(licenseText))
.pipe(gulp.dest('dist'))
.pipe(gulp.dest('demo/js/dependencies/'));
});
gulp.task('concat', function() {
var closureStart = '(function(window) {\n';
var closureEnd = '\nwindow.LocalModel = LocalModel;\n' +
'window.LocalSchema = LocalSchema;\nwindow.LocalDocument ' +
'= LocalDocument;\n\n}(window));';
var startingComment = '/*!\n * LocalModel\n * Developer: Rick Craig' +
'\n * https://github.com/RickCraig/localmodel\n*/\n\n';
return gulp.src(paths.scripts)
.pipe(replace(/'use strict';\n\n/g, ''))
.pipe(concat('localmodel.js'))
.pipe(insert.prepend(closureStart))
.pipe(insert.prepend(startingComment))
.pipe(insert.append(closureEnd))
.pipe(gulp.dest('dist'));
});
tasks.templates = function assetsTemplates() {
let sources = [path.join(settings.BASE_DIR, './components/**/*.vue')]
return gulp.src(sources)
.pipe(vueCompiler({
commonjs: false,
namespace: 'global.templates',
pathfilter: ['src', 'components', 'node_modules'],
}))
.on('error', notify.onError('Error: <%= error.message %>'))
.pipe(ifElse(settings.BUILD_OPTIMIZED, () => minifier()))
.pipe(concat('templates.js'))
.pipe(insert.prepend('global.templates={};'))
.pipe(gulp.dest(path.join(settings.BUILD_DIR, 'js')))
.pipe(size(_extend({title: 'templates'}, settings.SIZE_OPTIONS)))
}
done => {
gulp
.src(['**/*.css', 'scss/index*'], {
base: distPath(),
cwd: distPath()
})
.pipe(gulpinsert.prepend(`/*! ${DISPLAY_NAME} ${SLDS_VERSION} */\n`))
.pipe(gulp.dest(distPath()))
.on('error', done)
.on('finish', done);
},
done => {